Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using time.gov to get the current time

1 view
Skip to first unread message

Rick

unread,
Dec 19, 2009, 5:17:19 PM12/19/09
to pytho...@python.org
Is there any way to get the current time from time.gov using urllib2 or something similar?

Does anyone have any examples of doing this?

Thanks!
Rick King
Southfield MI

Matt Nordhoff

unread,
Dec 19, 2009, 8:45:21 PM12/19/09
to Rick, pytho...@python.org

Why isn't your local system's clock accurate enough?
--
Matt Nordhoff

Matt Nordhoff

unread,
Dec 19, 2009, 9:18:48 PM12/19/09
to Rick, pytho...@python.org

Bah, I'm better at IRC than e-mail... Anyway:

The easiest way to get highly-accurate time is with an "apt-get install
ntp" (or your OS's equivalent), and that solves it for all of your
applications, not just this one.

The time synchronization solutions that exist today are the result of
decades of development by experts. If you try to write some solution
yourself, it will not be as accurate (though that's okay if it still
meets your accuracy requirements), and you're liable to make some
mistake* and wind up with a bunch of angry NTP server operators chasing
after you with torches and pitchforks.

* Such as making excessively-frequent requests, or making more frequent
requests if the server appears down, or ignoring NTP Kiss-o'-Death
packets. Do not do these things!
--
Matt Nordhoff

0 new messages