fix bug when registering multiple listeners and change sunrise/sunset to non-ha impl

This commit is contained in:
Sam Lewis
2023-01-12 22:33:38 -05:00
parent a868c08d40
commit e58a75388e
10 changed files with 112 additions and 62 deletions

View File

@@ -21,7 +21,7 @@ func GetId() int64 {
func ParseTime(s string) carbon.Carbon {
t, err := time.Parse("15:04", s)
if err != nil {
log.Fatalf("Failed to parse time string \"%s\"; format must be HH:MM.", s)
log.Fatalf("Failed to parse time string \"%s\"; format must be HH:MM.\n", s)
}
return carbon.Now().SetTimeMilli(t.Hour(), t.Minute(), 0, 0)
}
@@ -29,7 +29,7 @@ func ParseTime(s string) carbon.Carbon {
func ParseDuration(s string) time.Duration {
d, err := time.ParseDuration(s)
if err != nil {
panic(fmt.Sprintf("Couldn't parse string duration: \"%s\" see https://pkg.go.dev/time#ParseDuration for valid time units", s))
log.Fatalf(fmt.Sprintf("Couldn't parse string duration: \"%s\" see https://pkg.go.dev/time#ParseDuration for valid time units\n", s))
}
return d
}