time.time() under load between two machines

Tim Peters tim.peters at gmail.com
Fri Jul 22 13:30:52 EDT 2005


[kwharrigan at yahoo.com]
> I am seeing negative latencies of up to 1 second.  I am  using ntp to
> synchronize both machines at an interval of 2 seconds, so the clocks
> should be very much in sync (and are from what I have observed).  I
> agree that it is probably OS, perhaps I should hop over to a Microsoft
> newsgroup and pose the question, although I'm sure they will find a way
> to blame it on Python.

That won't be easy <wink>.  This is how Python computes time.time() on
Windows (it's C code, of course):

	struct timeb t;
	ftime(&t);
	return (double)t.time + (double)t.millitm * (double)0.001;

`ftime()` there is from Microsoft's C library:

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_CRT__ftime.asp>

IOW, Python basically returns exactly what MS's ftime() returns, after
converting it to a double-precision float.



More information about the Python-list mailing list