What makes you believe that the two machines' clocks are perfectly
synchronized?  If they're not, it easily explains the result.

I wrote a simple client/server program similar to what you described.
Running on two RedHat 9 machines on a local network, I generally
observed a time delta of 2ms (compared to typical 0.17ms latency
reported by "ping"), never in a negative direction.  These machines
times are synchronized by ntpd from the package ntp-4.1.2-0.rc1.2.

My program can be run like this:
    rsh otherhost python timely.py -s | python timely.py -r
the values printed are the difference between the remote time before the
message is sent and the local time after the message is received.

You mention using Windows.  I don't know whether Windows machines by
default use anything as sophisticated as ntpd to keep their clocks
accurate.

Whatever is going on in your case, I suspect it is the operating system,
not Python.

Jeff

import os, sys, time

def serve():
    while 1:
        data = struct.pack("!d", time.time())
        os.write(1, data)
        time.sleep(1)

def recv(fileno):
    while 1:
        data = struct.unpack("!d", os.read(fileno, 8))[0]
        now = time.time()
        print now - data

if sys.argv[1] == "-s":
    serve()
else:
    recv(0)

Attachment: pgprDCiGXFdi3.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to