From: Antoine Pitrou Date: Sat, 23 Nov 2013 14:23:26 +0000 (+0100) Subject: Issue #19727: os.utime(..., None) is now potentially more precise under Windows. X-Git-Tag: v3.4.0b1~69^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=91a7af3e48b7e36bd937998e7076c3fe2e812de2;p=thirdparty%2FPython%2Fcpython.git Issue #19727: os.utime(..., None) is now potentially more precise under Windows. --- diff --git a/Misc/NEWS b/Misc/NEWS index 93301ffc57bc..3cfe2347a679 100644 --- 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. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 71b143739431..4c96204158ac 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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);