Steve Dower added the comment:
The "000" or "500" still smells of floating point rounding to me. Windows
appears to round-trip the values provided perfectly:
import ctypes
def do_test(t):
h = ctypes.windll.kernel32.CreateFileW("test.txt", 0xC0000000, 7, None, 2,
0, 0)
assert h != -1
try:
mt1 = ctypes.c_uint64(t)
assert ctypes.windll.kernel32.SetFileTime(h, None, None,
ctypes.byref(mt1)) != 0
mt2 = ctypes.c_uint64()
assert ctypes.windll.kernel32.GetFileTime(h, None, None,
ctypes.byref(mt2)) != 0
assert mt1.value == mt2.value
print(mt2.value)
finally:
assert ctypes.windll.kernel32.CloseHandle(h) != 0
>>> do_test(123)
123
>>> do_test(999999999999999999)
999999999999999999
Now, I'm not going to make any claims about GetSystemTime's accuracy, and there
could well be floating point conversions within there that cause the rounding
issue, but I'm more inclined to think that one of Python's conversions is at
fault.
Of course, an easy way around this would be to sleep for >100ns before touching
the file again.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19715>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com