diff options
author | Guido van Rossum <guido@python.org> | 1999-02-16 14:37:28 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-02-16 14:37:28 (GMT) |
commit | b8c3cbdd50badf2ecf5da9d62a91959162695fa1 (patch) | |
tree | cabc39c76a0dff5c719ae37408abcf9fefb13b53 /Modules | |
parent | cce8d2a85a207443257f768ad11d7be833d056c6 (diff) | |
download | cpython-b8c3cbdd50badf2ecf5da9d62a91959162695fa1.zip cpython-b8c3cbdd50badf2ecf5da9d62a91959162695fa1.tar.gz cpython-b8c3cbdd50badf2ecf5da9d62a91959162695fa1.tar.bz2 |
Fixed totally bogus conversion factors used in the Win32 version of
os.times().
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 013e3b1..8dc079e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2193,11 +2193,18 @@ posix_times(self, args) if (!PyArg_NoArgs(args)) return NULL; hProc = GetCurrentProcess(); - GetProcessTimes(hProc,&create, &exit, &kernel, &user); + GetProcessTimes(hProc, &create, &exit, &kernel, &user); + /* The fields of a FILETIME structure are the hi and lo part + of a 64-bit value expressed in 100 nanosecond units. + 1e7 is one second in such units; 1e-7 the inverse. + 429.4967296 is 2**32 / 1e7 or 2**32 * 1e-7. + */ return Py_BuildValue( "ddddd", - (double)(kernel.dwHighDateTime*2E32+kernel.dwLowDateTime)/2E6, - (double)(user.dwHighDateTime*2E32+user.dwLowDateTime) / 2E6, + (double)(kernel.dwHighDateTime*429.4967296 + + kernel.dwLowDateTime*1e-7), + (double)(user.dwHighDateTime*429.4967296 + + user.dwLowDateTime*1e-7), (double)0, (double)0, (double)0); |