Message9407

Author pekka.klarck
Recipients pekka.klarck
Date 2015-01-16.01:19:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1421371174.9.0.00606910782949.issue2256@psf.upfronthosting.co.za>
In-reply-to
Content
It seems that with Jython 27b4 preview on Windows os.stat returns wrong mtime and atime if these times are in DST. This problem doesn't occur on Linux, with Jython 2.5, or with files with mtime and atime 

To reproduce:
1) Create a new file and verify that Python and Jython 2.7 return same mtime and atime:
E:\>python -c "open('test.txt', 'w').close()"

E:\>python -c "import os; print os.stat('test.txt')"
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0L, st_atime=1421370960L, st_mtime=1421370960L, st_ctime=1421370960L)

E:\>jython -c "import os; print os.stat('test.txt')"
posix.stat_result(st_mode=33188, st_ino=0, st_dev=4L, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1421370960, st_mtime=1421370960, st_ctime=1421370960)


2) Set mtime and atime to some time in June, 2015 and verify that Python returns those times:
E:\>python -c "import os; os.utime('test.txt', (1433109600, 1433109600))"

E:\>python -c "import os; print os.stat('test.txt')"
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=
0, st_size=0L, st_atime=1433109600L, st_mtime=1433109600L, st_ctime=1421370375L)


3) Jython returns different mtime and atime:
E:\>jython -c "import os; print os.stat('test.txt')"
posix.stat_result(st_mode=33188, st_ino=0, st_dev=4L, st_nlink=1, st_uid=0, st_g
id=0, st_size=0, st_atime=1433106000, st_mtime=1433106000, st_ctime=1421370375)


The difference between times returned by Jython and times set and verified with Python is 3600s i.e. 1h. I guess this has something to do with DST, especially because files created now in standard time have correct mtime and atime.
History
Date User Action Args
2015-01-16 01:19:35pekka.klarcksetrecipients: + pekka.klarck
2015-01-16 01:19:34pekka.klarcksetmessageid: <1421371174.9.0.00606910782949.issue2256@psf.upfronthosting.co.za>
2015-01-16 01:19:34pekka.klarcklinkissue2256 messages
2015-01-16 01:19:32pekka.klarckcreate