[Python-Dev] time.clock() on windows

Mark Hammond mhammond at skippinet.com.au
Thu Oct 22 13:04:16 CEST 2009


On 22/10/2009 3:45 PM, Robert Collins wrote:
> On Thu, 2009-10-22 at 15:21 +1100, Mark Hammond wrote:
>
>>   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?

Off the top of my head, I guess that depends on the actual accuracy 
required (ie, how many clock ticks elapse between querying the time and 
the high-resolution timer).  Starting at 0 works fine for profiling in a 
single process, the predominant use-case when this was done; I guess it 
depends on the specific requirements and time-intervals being dealt with 
in the cross-process case which determines how suitable that might be?

Cheers,

Mark


More information about the Python-Dev mailing list