os.path.getmtime() doesn't return fraction of a second
Posted
by haridsv
on Stack Overflow
See other posts from Stack Overflow
or by haridsv
Published on 2010-03-11T20:50:37Z
Indexed on
2010/03/11
20:54 UTC
Read the original article
Hit count: 248
I compile python 2.6.4 for centos 5.3 and find this issue that os.path.getmtime() or os.stat().m_time doesn't have the fraction part. As per docs, if os.stat_float_times() True, then it should return float value. In my case, I do see it as float, but no fraction part (it is 0).
In [3]: os.path.getmtime('/tmp')
Out[3]: 1268339116.0
In [4]: os.stat('/tmp')
Out[4]: posix.stat_result(st_mode=17407, st_ino=508897L, st_dev=29952L, st_nlink=7, st_uid=0, st_gid=0, st_size=4096L, st_atime=1268101696, st_mtime=1268339116, st_ctime=1268339116)
In [5]: os.stat_float_times()
True
In [6]: os.stat('/tmp').st_mtime
Out[6]: 1268339116.0
It is also strange that the stat() output seems like an int. On windows, I do see a fraction part with the same python version. I am running centos on top of colinux, could that be playing a role, or is it some python build issue? I couldn't find any hits for generic colinux issue. May be it is how colinux configures the filesystem? What would I need to check in that case?
© Stack Overflow or respective owner