STINNER Victor <vstin...@python.org> added the comment:

"""
$ ./python utime_stat_localtime2.py 
os.utime (sec): 4386268800
os.stat (sec int): 2147483647
os.stat (sec float): 2147483647.0
os.stat (ns): 2147483647000000000
"""

It doesn't make sense !? In msg360916, you had:

os.stat (sec): 4386268800 <= os.stat().st_mtime
os.stat (ns): 2147483647000000000 <= os.stat().st_mtime._ns

How is it possible that sometimes st_mtime is right, and sometimes st_mtime is 
so plain wrong?

--

Test setting mtime in Python, reading mtime using /usr/bin/stat, then reading 
file stat in Python:

$ touch testfn

$ python3 -c 'import os; os.utime("testfn", (4386268800, 4386268800))'

$ stat testfn 
(...)
Modify: 2108-12-30 01:00:00.000000000 +0100
(...)

$ python3 -c 'import os; st=os.stat("testfn"); print(st); print(tuple(st)); 
print(st.st_mtime_ns)'

os.stat_result(st_mode=33204, st_ino=24648296, st_dev=40, st_nlink=1, 
st_uid=1000, st_gid=1000, st_size=0, st_atime=4386268800, st_mtime=4386268800, 
st_ctime=1580263179)
(33204, 24648296, 40, 1, 1000, 1000, 0, 4386268800, 4386268800, 1580263179)
4386268800000000000

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39460>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to