This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.stat() subsecond file mode time is incorrect on Windows
Type: Stage:
Components: None Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: glassfordm, loewis
Priority: normal Keywords:

Created on 2006-09-25 15:08 by glassfordm, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg29982 - (view) Author: Mike Glassford (glassfordm) Date: 2006-09-25 15:08
Either the new ability of os.stat() to report subsecond
file modification times, or the os.utime() function,
appears to have a bug on Windows. The following script
illustrates. The problem is that the decimal part of
the modification time reported by os.stat() is always
equal to the decimal part of what was passed to
os.utime() divided by ten (and rounded).

###Begin Script
import os

strPath = "c:/test.xxx"

#Create the file
f = open(strPath, 'w')
f.close()

#Set the file mod time
t1 = 1159195039.2
os.utime(strPath, (t1, t1))

#Get the file mod time
t2 = os.stat(strPath).st_mtime

print t1, t2

###Sample output
1159195039.2 1159195039.02
msg29983 - (view) Author: Mike Glassford (glassfordm) Date: 2006-09-25 15:10
Logged In: YES 
user_id=963931

Sorry, although it can be inferred from the report, I should
mention that this is with Python 2.5.
msg29984 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-10-09 20:45
Logged In: YES 
user_id=21627

Thanks for the report. This is now fixed in r52257 and r52258.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44027
2006-09-25 15:08:57glassfordmcreate