Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'dst,': 0.09; 'ignoring': 0.09; 'string)': 0.09; 'timestamps': 0.09; '(but': 0.15; '"seconds': 0.16; 'assumed,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:values': 0.16; 'timezones': 0.16; 'utc': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'received:209.85.214.174': 0.21; "i'd": 0.22; 'minutes.': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'i.e.': 0.27; 'message- id:@mail.gmail.com': 0.27; 'basic': 0.30; 'suggestion': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'first': 0.61; '(that': 0.62; 'times': 0.63; 'jul': 0.65; 'easier!': 0.84; 'forced': 0.84; 'notion': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=UpgomflJIvS+G+v4vWP+9XGH6RcLI/roNkUx53Qgagw=; b=e2xKh4dymyHaBr2jvCxFbm2qv0bOn8S31TEhewfWLc0ZxuBBGzPZwA6BvzdyfzgnPL Ka32Ky/ufvrHtQ0bjT5XPUP19mA63ZxsfpU6RxDuvtOK2DGd8EV0dWbIvOrP3J+J1zZb pUEaPXqlPoxpJq4JodrcEyLd22f1+bT5PPOwNPYqXdQwam1Jnak8Pf3otEiMKVHTJQB5 dmODmI7Vj9lEhEZFZnjKIozSDBTMDThiTbiQu8r1itsxoG3Srg+GVpgMxiS0/Ihhbh23 j9QWhF3ZzqxDMGgx8FmzcuVMZMpHtHr2CuIbYeejVLwRg4xpRzBTR3CeFwABhjVsz6Yf xcdg== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 5 Jul 2012 11:09:50 +1000 Subject: Re: simpler increment of time values? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341450594 news.xs4all.nl 6948 [2001:888:2000:d::a6]:43641 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24889 On Thu, Jul 5, 2012 at 10:29 AM, Vlastimil Brom 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