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


Groups > comp.lang.python > #24895

Re: simpler increment of time values?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'case.': 0.05; '(using': 0.07; 'alternatives': 0.09; 'minus': 0.09; 'solution,': 0.09; 'string)': 0.09; 'timestamps': 0.09; 'assumed,': 0.16; 'received:209.85.161.174': 0.16; 'subject:values': 0.16; 'code,': 0.18; 'sender:addr:gmail.com': 0.18; 'equivalent': 0.20; 'mostly': 0.20; 'all,': 0.21; 'libraries': 0.22; "i'd": 0.22; 'minutes.': 0.23; 'solutions.': 0.23; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'first,': 0.27; 'i.e.': 0.27; 'object,': 0.27; 'thoughts': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'probably': 0.29; 'basic': 0.30; 'function': 0.30; 'code': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'add': 0.36; 'but': 0.36; 'enough': 0.36; 'possible': 0.37; '(for': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'more': 0.63; 'notion': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=AcHqSgjCoLm1i9YmGq6OPR3EtShaEV7/F/VNRUtFu9E=; b=gsMyHS+km1nQfkdUegzSsO9lH9+nDCxf90a1VnBxeXxwz+ZyLvAutff221EVqBeYtT tN8qRbKXbU3JiUhronBdWkewI6uR9XBTWjzGOYF2AcEZA3wtxo0fjp7wezOz0PBXNfCf PqrsUL0SaJjY/1U3jd1nNcL1D0qWJtFcznsy8Ms92rdY4mz2P0FVxhpYRZDemBnIaz68 Mr4Le6JYlqtxtsa+bjeVMSNTtWTUgpBo8cEpUKbRvWugLS0z3+rlVheAb72KjsgdcAQB R+viWt9ZdTZXQABPY9Bp/DW3SP5fvjVFycnLPhpu2kqQzi4fQhC6w+6U2qgK71CHwEAS wirg==
MIME-Version 1.0
Sender jsf80238@gmail.com
In-Reply-To <CAHzaPEO5D498zepGC0EVVURdUE7qxYJk6ksd5yS_Xj_hh5iiyQ@mail.gmail.com>
References <CAHzaPEO5D498zepGC0EVVURdUE7qxYJk6ksd5yS_Xj_hh5iiyQ@mail.gmail.com>
Date Wed, 4 Jul 2012 22:57:23 -0600
X-Google-Sender-Auth nBAG3JWS8_ybaZOLOLBMqR4jFOw
Subject Re: simpler increment of time values?
From Jason Friedman <jason@powerpull.net>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1810.1341464253.4697.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341464253 news.xs4all.nl 6922 [2001:888:2000:d::a6]:39697
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24895

Show key headers only | View raw


> Hi all,
> 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.
> I first thought, it would be possible to just add a timedelta to a
> time object, but, it doesn't seem to be the case.
>
> The code I came up with (using time and datetime modules) seems rather
> convoluted and I would like to ask about some possible more
> straightforward alternatives I missed.
> The equivalent function (lacking validation) without the (date)time
> libraries seems simple enough (for this limited and individual task).
> Although it is probably mostly throw-away code, which seems to do what
> I need, I'd be interested in better/more elegant... solutions.

I have some thoughts on a solution, but first, what is 12:45 plus 12
hours?  What is 12:45 minus 13 hours?

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


Thread

Re: simpler increment of time values? Jason Friedman <jason@powerpull.net> - 2012-07-04 22:57 -0600

csiph-web