-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] - switching daylight saving time doesn't work #318
Comments
hey @wolfgang-braun thanks for reporting. An hour sounds a lot like a daylight time issue. Does Europe/Berlin use daylight time? |
Hi @JohnRoesler, yes it does. The switch was on Sunday. Using the former maintainers package a container restart did the trick. Furthermore I can't reproduce it using playground package main
import (
"log"
"time"
"github.com/go-co-op/gocron"
)
func main() {
location, err := time.LoadLocation("Europe/Berlin")
if err != nil {
panic(err)
}
logLocalTime(location)
s := gocron.NewScheduler(location)
s.Every(1).Day().At("00:00:05").Do(logLocalTime, location)
s.StartBlocking()
}
func logLocalTime(location *time.Location) {
log.Println("Europe/Berlin time: ", time.Now().In(location).Format("2006-01-02 15:04:05"))
}
This behavior is actually expected: One difference compared to my use case is that system/application time zone = cron time zone. |
Can confirm the behaviour, ran into the same issue. |
Did this resolve? We had a similar issue a while ago that was related to the underlying docker container the app was being run in. I'm inclined to suspect something with the host system's time / tz files being the cause of this issue. |
reopen if this is still an issue |
Describe the bug
Task gets executed an hour too late. Local time / location is correctly set.
To Reproduce
Output:
2022/03/28 10:00:00 - logging local time: 2022-03-28 10:00:00
Expected behavior
2022/03/28 09:00:00 - logging local time: 2022-03-28 09:00:00
Version
github.com/go-co-op/gocron v1.13.0
Other
Related
Thank you!
The text was updated successfully, but these errors were encountered: