You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Still, there are more issues with local time and DST transition.
CRON uses local system time on Linux machines and users expect cron masks to work using local system time. However there are problems with e.g. daily masks when crossing DST transition time.
In the simplest scenario I want to use hourly mask 0 * * * * and daily masks 0 0 * * * in local time and users expect them to just work in their local time.
Examples using: croniter 0.3.15, Python 3.5.2
import json, calendar, time, pytz
from datetime import datetime
from croniter import croniter
tz = pytz.timezone('Europe/Warsaw')
standard -> DST transition at 2017-03-26 01:59+1:00 -> 03:00+2:00
The reason this gives invalid results is that croniter converts datetime to timestamp internally, does arithmetics and converts back to datetime. This way information about local time is lost at conversion point and this method gives bad results after converting back to local. The only way to do this work correctly with local time is to do the arithmetics on localized datetime object using timedeltas and tz.normalize(...) - to check if e.g. midnight is still midnight after post-arithmetics normalization.
The text was updated successfully, but these errors were encountered:
First of all thanks for fixing #35
Still, there are more issues with local time and DST transition.
CRON uses local system time on Linux machines and users expect cron masks to work using local system time. However there are problems with e.g. daily masks when crossing DST transition time.
In the simplest scenario I want to use hourly mask 0 * * * * and daily masks 0 0 * * * in local time and users expect them to just work in their local time.
Examples using: croniter 0.3.15, Python 3.5.2
standard -> DST transition at 2017-03-26 01:59+1:00 -> 03:00+2:00
DST-> standard transition at 2017-10-29 02:59+2:00 -> 02:00+1:00
The reason this gives invalid results is that croniter converts datetime to timestamp internally, does arithmetics and converts back to datetime. This way information about local time is lost at conversion point and this method gives bad results after converting back to local. The only way to do this work correctly with local time is to do the arithmetics on localized datetime object using timedeltas and tz.normalize(...) - to check if e.g. midnight is still midnight after post-arithmetics normalization.
The text was updated successfully, but these errors were encountered: