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
from croniter import croniter
from datetime import datetime
import pandas as pd
import tzlocal
import pytz
import sys
local = pytz.timezone('America/Los_Angeles')
print(local)
c = croniter('* * * * *', datetime(2017, 3, 12, tzinfo=local))
s = set()
l = list()
while True:
t = c.get_next(datetime)
ms = int(t.timestamp() * 1000)
if ms >= 1489309140000:
s.add(ms)
l.append(ms)
print(t, ms)
if ms >= 1489312800000:
break
print(len(s))
print(len(l))
assert(len(s) == len(l))
Expected behavior:
Console output should not contain repeated timestamps.
Console output should not contain timestamps which go backwards in time.
Assertion in the code should pass, since timestamps should not repeat.
Observed behavior:
Console output contains repeated timestamps.
Console output contains timestamps which go backwards in time.
Notice that every minute between 2017-03-12 01:00:00-08:00 and 2017-03-12 01:59:00-08:00 are repeated once, apparently at the hour of daylight saving time switch-over.
The text was updated successfully, but these errors were encountered:
Same problem happens if the asked output type is float (e.g. c.get_next(float)).
royitaqi
changed the title
croniter return repeated timestamps in a particular hour (might relate to daylight saving time but not sure)
[0.3.20] croniter return repeated timestamps in a particular hour (might relate to daylight saving time but not sure)
Jan 23, 2018
System:
Versions:
Test code (name it
test.py
):Expected behavior:
Observed behavior:
Observed console output:
Notice that every minute between
2017-03-12 01:00:00-08:00
and2017-03-12 01:59:00-08:00
are repeated once, apparently at the hour of daylight saving time switch-over.The text was updated successfully, but these errors were encountered: