[issue19007] precise time.time() under Windows 8: use GetSystemTimePreciseAsFileTime

STINNER Victor report at bugs.python.org
Sat Aug 1 00:05:18 CEST 2015


STINNER Victor added the comment:

Note: GetSystemTimePreciseAsFileTime() is restricted to desktop applications.

The windowstimestamp.com has a warning on this function:

http://www.windowstimestamp.com/description

"""
2.1.4.2.  Desktop Applications: GetSystemTimePreciseAsFileTime()

(...)
The function shall also be used with care when a system time adjustment is active. Current Windows versions treat the performance counter frequency as a constant. The high resolution of GetSystemTimePreciseAsFileTime() is derived from the performance counter value at the time of the call and the performance counter frequency. However, the performance counter frequency should be corrected during system time adjustments to adapt to the modified progress in time. Current Windows versions don't do this. The obtained microsecond part may be severely affected when system time adjustments are active. Seconds may consist of more or less than 1.000.000 microseconds. Microsoft may or not fix this in one of the next updates/versions.
(...)
As of May, 2015 the inaccuracy of GetSystemTimePreciseAsFileTime() during system time adjustments persists for the preview versions of Windows 10.
"""

Is it ok to switch to GetSystemTimePreciseAsFileTime() for Python time.time()?

----------

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


More information about the Python-bugs-list mailing list