From f61c919734519bc02e234b240ed8917ee6dc5b7a Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Thu, 27 Jan 2022 16:57:49 +0100 Subject: [PATCH] Apply the offset everywhere --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index a1d531b..09f505e 100644 --- a/main.go +++ b/main.go @@ -63,6 +63,7 @@ func getNextSunriseSunset() (time.Time, time.Time) { if err != nil { panic(err) } + sunset = sunset.Add(-time.Minute*30) p2 := sunrisesunset.Parameters{ Latitude: 51.9808334, @@ -70,6 +71,10 @@ func getNextSunriseSunset() (time.Time, time.Time) { Date: time.Now().Add(time.Hour * 24), } sunrise2, sunset2, err := p2.GetSunriseSunset() + if err != nil { + panic(err) + } + sunset2 = sunset2.Add(-time.Minute*30) now := time.Now() if now.After(sunrise) { @@ -80,8 +85,6 @@ func getNextSunriseSunset() (time.Time, time.Time) { sunset = sunset2 } - sunset = sunset.Add(-time.Minute*30) - return sunrise, sunset } @@ -97,6 +100,7 @@ func isDay() bool { if err != nil { panic(err) } + sunset = sunset.Add(-time.Minute*30) return time.Now().After(sunrise) && time.Now().Before(sunset) }