time
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Tue Oct 7 22:46:10 EDT 2008
In message <mailman.2124.1223392354.3487.python-list at python.org>, Gabriel
Rossetti wrote:
> If I look at my clock, it's 16:59 (4:59pm), if I type "date" in a
> terminal, it says the same thing.
Try this:
date
gives local time, while
TZ=UTC date
gives UTC time.
> I'm wanting to write a simple NTP-type server/client (it's
> not NTP at all actually, but does the same thing). The idea is that a
> client sends it it's UTC offset and it returns the current time, so the
> server side checks the time and adds the UTC offset given by the client.
It's probably easiest if the server doesn't have to know or care what
timezone the client is in. This is how NTP works: timezones are considered
to be a machine-internal matter, and all times exchanged by the protocol
are in UTC. So have your protocol always work in UTC.
More information about the Python-list
mailing list