[ python-Bugs-1565150 ] os.stat() subsecond file mode time is incorrect on Windows

SourceForge.net noreply at sourceforge.net
Tue Sep 26 06:20:42 CEST 2006


Bugs item #1565150, was opened at 2006-09-25 08:08
Message generated for change (Settings changed) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1565150&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
>Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Glassford (glassfordm)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.stat() subsecond file mode time is incorrect on Windows

Initial Comment:
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

----------------------------------------------------------------------

Comment By: Mike Glassford (glassfordm)
Date: 2006-09-25 08:10

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1565150&group_id=5470


More information about the Python-bugs-list mailing list