Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24889

Re: simpler increment of time values?

References <CAHzaPEO5D498zepGC0EVVURdUE7qxYJk6ksd5yS_Xj_hh5iiyQ@mail.gmail.com>
Date 2012-07-05 11:09 +1000
Subject Re: simpler increment of time values?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1805.1341450594.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jul 5, 2012 at 10:29 AM, Vlastimil Brom
<vlastimil.brom@gmail.com> wrote:
> I'd like to ask about the possibilities to do some basic manipulation
> on timestamps - such as incrementing a given time (hour.minute -
> string) by some minutes.
> Very basic notion of "time" is assumed, i.e. dateless,
> timezone-unaware, DST-less etc.

My first suggestion would be to work with Unix times (that is, store
your time as "seconds since 1970", also called a time_t). That's
forced to be on UTC (but ignoring leap seconds) so you don't have to
worry about timezones or DST, and incrementing by X minutes is simply
adding X*60 to it. It makes your job a lot easier!

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: simpler increment of time values? Chris Angelico <rosuav@gmail.com> - 2012-07-05 11:09 +1000

csiph-web