But this doesn't help, because then you still don't know whether it's dst or not. You then would have to jump through whatever convolutions to do that calculation.

All I want to know is the *current* offset between local time and utc. I know the system has this information already; it doesn't require any kind of fancy calculations about global politics or anything.


On Feb 17, 2010, at 3:12 PM, Kent Johnson wrote:

On Wed, Feb 17, 2010 at 3:48 PM, David Perlman <dperl...@wisc.edu> wrote:
Surely there is a way to simply print out the local time, date and time zone without needing to write your own class... I can't believe this is the only
way...

Here's why I don't believe it. Both the datetime and time modules provide both functions for returning the current local time, and the current utc time. So, assuming that those functions are trustworthy, it *must* be true that the OS always knows the current offset from utc time. So why is there no straightforward way to get that offset in python? I mean, I can do this:

time.timezone gives the offset for standard time.

--
-dave----------------------------------------------------------------
"Pseudo-colored pictures of a person's brain lighting up are
undoubtedly more persuasive than a pattern of squiggles produced by a
polygraph.  That could be a big problem if the goal is to get to the
truth."  -Dr. Steven Hyman, Harvard



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to