[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

STINNER Victor report at bugs.python.org
Tue Dec 4 09:46:58 CET 2012


STINNER Victor added the comment:

I didn't read the whole issue, but the following code makes sense.

+try:
+    import posix
+except ImportError:
+    # Windows has nanosecond utime resolution.
+    UTIME_EPSILON = 2e-9
+else:
+    import sysconfig
+    if 'HAVE_UTIMENSAT' in posix._have_functions:
+        UTIME_EPSILON = 2e-9
+    elif 'HAVE_UTIMES' in sysconfig.get_config_vars():
+        UTIME_EPSILON = 2e-6
+    else:
+        UTIME_EPSILON = 1.0

Windows doesn't really have nanosecond resolution: the common Windows unit is 100 ns. See GetFileInformationByHandle() documentation: its BY_HANDLE_FILE_INFORMATION  structure has FILETIME fields, and FILETIME uses the 100 ns unit.

We might expose this unit (UTIME_EPSILON, in the os module maybe?) as we done for time function with time.get_clock_info().

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15745>
_______________________________________


More information about the Python-bugs-list mailing list