inaccuracy in the time module

alf ask at me
Mon Sep 4 16:06:02 EDT 2006


Paul Rubin wrote:
> alf <ask at me> writes:
> 
>> >>> t=time()
>> >>> mktime(gmtime(t))-t
>>17999.680048942566
>>why there is a difference?
> 
> 
> time() is a floating point number with fractional seconds.
> gmtime()'s resolution is one second.

thx, got it now. replacing with "t=round(time())" fixes the problem.

-- 
Andy



More information about the Python-list mailing list