calling functions at the same time

Grant Edwards grante at visi.com
Sat May 1 12:42:49 EDT 2004


In article <kNIkc.1367$U75.564 at edtnps89>, Knio wrote:

> You can't get greater then 1ms accuracy when measuring a time
> on todays machines, and that will be less when measuring time
> over a network...

Not sure what you mean by "todays machines", but on a
Pentium-class machine running Linux, you get approx 1us
resolution with calls to time.time():

import time
t = []
for i in range(10):
    t.append(time.time())
print t    

[1083429542.284164, 1083429542.2841799, 1083429542.2841859,
1083429542.2841921, 1083429542.284198, 1083429542.284204,
1083429542.284209, 1083429542.284215, 1083429542.2842209,
1083429542.2842269]

The Linux network stack also provides timestamps on the network
packets with at least 1us resolution.

> calling 4 ping functions one after the other will complete in much less 
> then 1ms (assuming its asynchronous, or threaded). So, even if you could 
> manage to send 4 packets at *exactly* the same time,

People, Ethernet is a _serial_ protocol.  It allows exactly one
packet to be transmitted at a time.  There is no way to send
more than one packet at a time.

> it would be no more accurate.

-- 
Grant Edwards                   grante             Yow!  As President I
                                  at               have to go vacuum my coin
                               visi.com            collection!



More information about the Python-list mailing list