simpler increment of time values?

Chris Angelico rosuav at gmail.com
Wed Jul 4 21:09:50 EDT 2012


On Thu, Jul 5, 2012 at 10:29 AM, Vlastimil Brom
<vlastimil.brom at 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



More information about the Python-list mailing list