mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-07 13:15:19 -06:00
fix bug when registering multiple listeners and change sunrise/sunset to non-ha impl
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user