[Python-Dev] time.clock() on windows
Kristján Valur Jónsson
kristjan at ccpgames.com
Thu Oct 22 11:51:53 CEST 2009
> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames.com at python.org
> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf
> Of Robert Collins
> > I'd be very surprised if any applications rely on the fact that each
> > process starts counting at zero, so if someone can come up with a
> > high-res counter which avoids that artifact I'd expect it could be
> > used.
>
> Could you offset it by the system time on the first call?
>
Since system time has low granularity, it would negate our attemt at having time.clock() reflect the same time between processes.
In my opinion, the simplest way is to simply stop setting choosing the first call as a zero base, and use whatever arbitrary time the system has chosen for us.
The documentation could then read:
"On Windows, this function returns wall-clock seconds elapsed since an
arbitrary, system wited, epoch, as a floating point number, based on the
Win32 function QueryPerformanceCounter. The resolution is typically better
than one microsecond."
K
More information about the Python-Dev
mailing list