if past time then rollover

master
Bel LaPointe 2018-06-27 14:19:59 -06:00
parent f9f8340056
commit b820714087
1 changed files with 4 additions and 1 deletions

View File

@ -52,8 +52,11 @@ func main() {
if err != nil {
panic(err)
}
if hour < now.Hour() || min < now.Minute() {
now = now.Add(time.Hour * 24)
}
thenTime := time.Date(now.Year(), now.Month(), now.Day(), hour, min, 0, 0, now.Location())
duration = thenTime.Sub(now).String()
duration = thenTime.Sub(time.Now()).String()
}
tickerInterval, err := time.ParseDuration(interval)