[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file
Xiang Zhang
report at bugs.python.org
Wed Nov 4 22:59:18 EST 2015
Xiang Zhang added the comment:
I'm afraid we can't say negative epoch is handled successfully on Linux.
Use $ touch -d "1 Jan 1900" test as a test, time.gmtime(os.fstat(f.fileno()).st_mtime) gives time.struct_time(tm_year=1899, tm_mon=12, tm_mday=31, tm_hour=15, tm_min=54, tm_sec=17, tm_wday=6, tm_yday=365, tm_isdst=0), which does not equals "1 Jan 1900". I think this is caused by python gmtime directly uses gmtime in C. Use the epoch of "1 Jan 1900" with C's gmtime does not give a right result. And while I am searching, I can not find any evidence that gmtime in C can give a right result with a negtive epoch.
And when I try the epoch of "1 Jan 1900" with "date -d @", it can generate the right result.
----------
nosy: +xiang.zhang
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25534>
_______________________________________
More information about the Python-bugs-list
mailing list