Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36091
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <barry@barrys-emacs.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'revision': 0.05; 'that?': 0.05; 'omit': 0.07; 'parser': 0.07; 'python': 0.09; 'garbage': 0.09; 'specifying': 0.09; 'tuple': 0.09; 'tuple.': 0.09; 'cc:addr :python-list': 0.10; 'properly': 0.15; 'elements,': 0.16; 'example?': 0.16; 'expects': 0.16; 'from:addr:barry': 0.16; 'mktime': 0.16; 'time).': 0.16; 'wrote:': 0.17; 'documented': 0.17; 'element': 0.17; "shouldn't": 0.17; 'specify': 0.17; 'jan': 0.18; 'putting': 0.20; 'earlier': 0.21; 'parse': 0.22; 'cc:2**0': 0.23; 'elements': 0.23; 'ignored.': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'testing': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(which': 0.26; 'wrote': 0.26; '(e.g.': 0.27; 'question': 0.27; 'attempting': 0.29; 'behaviour': 0.29; 'them?': 0.29; 'convert': 0.29; 'this.': 0.29; "i'm": 0.29; 'figure': 0.30; 'seconds': 0.30; 'year,': 0.30; 'docs': 0.33; 'hi,': 0.33; 'minimum': 0.34; 'needed': 0.35; 'expected': 0.35; 'subject:?': 0.35; 'really': 0.36; 'client': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'rather': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'talk': 0.38; 'notice': 0.39; 'header:Message-Id:1': 0.62; 'ago.': 0.66; 'day': 0.73; 'elements:': 0.84; 'subject:Using': 0.84; 'victor': 0.84 |
| Content-Type | text/plain; charset=us-ascii |
| Mime-Version | 1.0 (Mac OS X Mail 6.2 \(1499\)) |
| Subject | Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? |
| From | Barry Scott <barry@barrys-emacs.org> |
| In-Reply-To | <dfd18cf3-e2c0-4f0e-a4c1-a72924039a15@googlegroups.com> |
| Date | Thu, 3 Jan 2013 23:46:55 +0000 |
| Content-Transfer-Encoding | quoted-printable |
| References | <dfd18cf3-e2c0-4f0e-a4c1-a72924039a15@googlegroups.com> |
| To | Victor Hooi <victorhooi@gmail.com> |
| X-Mailer | Apple Mail (2.1499) |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.65.1357258479.2939.python-list@python.org> (permalink) |
| Lines | 48 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357258479 news.xs4all.nl 6990 [2001:888:2000:d::a6]:44407 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36091 |
Show key headers only | View raw
On 2 Jan 2013, at 08:01, Victor Hooi <victorhooi@gmail.com> wrote: > Hi, > > I'm using pysvn to checkout a specific revision based on date - pysvn will only accept a date in terms of seconds since the epoch. > > I'm attempting to use time.mktime() to convert a date (e.g. "2012-02-01) to seconds since epoch. > > According to the docs, mktime expects a 9-element tuple. > > My question is, how should I omit elements from this tuple? And what is the expected behaviour when I do that? > > For example, (zero-index), element 6 is the day of the week, and element 7 is the day in the year, out of 366 - if I specify the earlier elements, then I shouldn't really need to specify these. > > However, the docs don't seem to talk much about this. > > I just tried testing putting garbage numbers for element 6 and 7, whilst specifying the earlier elements: > >> time.mktime((2012, 5, 5, 23, 59, 59, 23424234, 5234234 ,0 )) > > It seems to have no effect what numbers I set 6 and 7 to - is that because the earlier elements are set? > > How should I properly omit them? Is this all documented somewhere? What is the minimum I need to specify? And what happens to the fields I don't specify? See the python docs the tuple is fully documented. 6 and 7 are not needed to figure out the seconds so are ignored. Did you notice the parse_datetime.py that is in the pysvn Client Example? Its a rather over the top date and time parser I wrote a long long time ago. (Which is missing some imports, hmm I cannot have tested this for a long time). It can parse things like "yesterday 10:34". Barry
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Victor Hooi <victorhooi@gmail.com> - 2013-01-02 00:01 -0800
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Vlastimil Brom <vlastimil.brom@gmail.com> - 2013-01-02 09:33 +0100
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Dave Angel <davea@dejaviewphoto.com> - 2013-01-02 09:06 -0500
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Roy Smith <roy@panix.com> - 2013-01-02 09:28 -0500
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Chris Angelico <rosuav@gmail.com> - 2013-01-03 01:51 +1100
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? roy@panix.com (Roy Smith) - 2013-01-02 12:27 -0500
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Chris Angelico <rosuav@gmail.com> - 2013-01-03 04:34 +1100
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Dave Angel <d@davea.name> - 2013-01-02 12:44 -0500
Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple? Barry Scott <barry@barrys-emacs.org> - 2013-01-03 23:46 +0000
csiph-web