I find the datetime.timestamp() function return different value on Linux and Windows. Here is a simple to to replicate it:
from datetime import date, time, datetime, timedelta
def main():
dt = datetime(2000, 1, 1)
edt = datetime(2006, 12, 31)
fname = 't1.csv'
f = open(fname, 'w')
f.write('date,timestamp\n')
while dt <= edt:
f.write('{0:%Y-%m-%d},{1:.0f}\n'.format(dt, dt.timestamp()))
dt += timedelta(days=1)
f.close()
return 0
Here is the LAST different part from Windows: (Windows7 64 + Python3.4.3 64)
...
2006-10-30,1162180800
2006-10-31,1162267200
2006-11-01,1162353600
2006-11-02,1162440000
2006-11-03,1162526400
2006-11-04,1162612800
2006-11-05,1162699200
...
Here is the corresponding Linux output: (RedHat6 64 + Python 3.4.3 64)
...
2006-10-30,1162184400
2006-10-31,1162270800
2006-11-01,1162357200
2006-11-02,1162443600
2006-11-03,1162530000
2006-11-04,1162616400
2006-11-05,1162702800
...
Systems all using the EST with automatic DST adjustment. Some observations:
- the linux output seems to be correct
- no difference observed after 2006 (I did not test above 12/31/2015)
- the difference seems to be 1 hour/3600 seconds
- the difference seems to happen only in those days around the DST change in that year (or around the time EU/US has different DST change date.)
Just wondering why timestamp() function behaves differently on windows and linux.