mvniekerk / tokio-cron-scheduler

Schedule tasks on Tokio using cron-like annotation
Apache License 2.0
499 stars 61 forks source link

Can 'tokio-cron-scheduler' support run in LOCAL time? #24

Closed rts-gordon closed 5 months ago

rts-gordon commented 2 years ago

Hi @mvniekerk I known that 'tokio-cron-scheduler' run in UTC, but under some scenario we need run cronjob in LOCAL time, so would you like to implement this feature? Thank you very much.

palstek commented 2 years ago

+1 I have a project where the job scheduling needs to be done in LOCAL time too. It needs to work across change from daylight savings time to normal time and vice versa. I like to implement this project in Rust. Any hints where to look in the source code to add this feature myself are welcome?

mvniekerk commented 2 years ago

Hey @CHCP & @palstek Thanks for the report.

Ok - I've found the same issue with my own project I'm using this crate for. Still need to come up with an elegant solution - but definetely part of pain I need to solve for myself as well.

@palstek so in lib/rs line 94 there is a function utc. This is the entry for converting the seconds post UNIX_EPOCH between the different Job types.

dumbasPL commented 1 year ago

any progress on this? Linux cron uses local system time, so most users will expect cron jobs they configure to run at system time, not UTC.

Hexagon commented 9 months ago

@mvniekerk If you migrate from cron to croner , there is time zone support - and support for extended syntax. Basically croner uses whatever timezone is supplied through a DateTime, so you can pass Utc::now, Local::now or a datetime with and timezone

See the "Why croner" section for a comparison

https://github.com/hexagon/croner-rust

Also relevant for PR #49

mvniekerk commented 5 months ago

Hi all (@Hexagon , @rts-gordon , @dumbasPL ) Did you check the latest release of this?