]> granicus.if.org Git - python/commitdiff
Issue #19727: os.utime(..., None) is now potentially more precise under Windows.
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 23 Nov 2013 14:23:26 +0000 (15:23 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 23 Nov 2013 14:23:26 +0000 (15:23 +0100)
Misc/NEWS
Modules/posixmodule.c

index 93301ffc57bc359d9da8e76ad983b60cc1fd2f1c..3cfe2347a67972168a5273d0a5c94a5452e20ea6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -68,6 +68,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #19727: os.utime(..., None) is now potentially more precise
+  under Windows.
+
 - Issue #17201: ZIP64 extensions now are enabled by default.  Patch by
   William Mallard.
 
index 71b143739431d6e7f765b6fb527088acf2a091a7..4c96204158ac78e98d981f63f481e5232c30f774 100644 (file)
@@ -4953,13 +4953,8 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
     }
 
     if (utime.now) {
-        SYSTEMTIME now;
-        GetSystemTime(&now);
-        if (!SystemTimeToFileTime(&now, &mtime) ||
-            !SystemTimeToFileTime(&now, &atime)) {
-            PyErr_SetFromWindowsErr(0);
-            goto exit;
-        }
+        GetSystemTimeAsFileTime(&mtime);
+        atime = mtime;
     }
     else {
         time_t_to_FILE_TIME(utime.atime_s, utime.atime_ns, &atime);