Using mktime to convert date to seconds since epoch - omitting elements from the tuple?

Chris Angelico rosuav at gmail.com
Wed Jan 2 12:34:32 EST 2013


On Thu, Jan 3, 2013 at 4:27 AM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.1574.1357138278.29569.python-list at python.org>,
> Chris Angelico  <rosuav at gmail.com> wrote:
>
>>> I assume you mean timestamps. A date doesn't need to worry about UTC
>>> the way a timestamp does.
>
> I'm not sure how a date and a timestamp differ in any significant
> way.  A date is just a very low-precision time.
>
> I suppose what's really essential is a way to quickly see the current
> UTC time.  That way, when you're looking at some event in a log file,
> it's easy to figure out, "that was 20 minutes ago", as opposed to,
> "that was 5 hours and 20 minutes ago".  I run my desktop in New York
> time (so I know when I'm supposed to eat lunch), but I also have a
> second clock widget displaying UTC time just below it.  Right now,
> it's 17:22.

The difference between "20 minutes ago" and "5 hours and 20 minutes
ago" doesn't really come up when your resolution is 86400 seconds, as
is the case with a date :)

I have the same sort of thing. My desktop's clock is on local time
(4:33AM), but my server tells me, when I type 'who', that "The current
UTC (GMT) time is: Wed 17:33:35" (it doesn't bother with the date,
only the day of week, as the main purpose of that time display is to
help people synchronize on weekly events).

ChrisA



More information about the Python-list mailing list