Skip to content

Commit

Permalink
fix: for consistency, implement CalcSunrise in terms of CalcDawn.
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Seymour <[email protected]>
  • Loading branch information
Jon Seymour committed Nov 3, 2014
1 parent fa91d0d commit eb45ffd
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions astrotime.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,7 @@ func CalcDawn(t time.Time, latitude float64, longitude float64, solarElevation f
// CalcSunrise calculates the sunrise, in local time, on the day t at the
// location specified in longitude and latitude.
func CalcSunrise(t time.Time, latitude float64, longitude float64) time.Time {
jd := CalcJD(t)
sunriseUTC := time.Duration(math.Floor(calcSunriseUTC(jd, latitude, longitude, SUNRISE)*60) * 1e9)
loc, _ := time.LoadLocation("UTC")
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, loc).Add(sunriseUTC).In(t.Location())
return CalcDawn(t, latitude, longitude, SUNRISE)
}

// Calculates the refractive correction for the specified solar elevation.
Expand Down

0 comments on commit eb45ffd

Please sign in to comment.