Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33630 > unrolled thread
| Started by | roy@panix.com (Roy Smith) |
|---|---|
| First post | 2012-11-20 11:18 -0500 |
| Last post | 2012-11-21 13:14 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
Printing time in "at" format? roy@panix.com (Roy Smith) - 2012-11-20 11:18 -0500
Re: Printing time in "at" format? Tim Chase <python.list@tim.thechases.com> - 2012-11-20 12:16 -0600
Re: Printing time in "at" format? Roy Smith <roy@panix.com> - 2012-11-20 13:24 -0500
Re: Printing time in "at" format? Hans Mulder <hansmu@xs4all.nl> - 2012-11-21 13:14 +0100
| From | roy@panix.com (Roy Smith) |
|---|---|
| Date | 2012-11-20 11:18 -0500 |
| Subject | Printing time in "at" format? |
| Message-ID | <k8gagp$gin$1@panix2.panix.com> |
I need to talk to an API which requires (for reasons totally beyond my comprehension), time specified in "at" format, i.e. the format accepted by the unix "at" command. This allows you to do such bizarre things as use "teatime" to indicate 4:00 PM. The best I can find for a specification is http://tinyurl.com/d5vddoa. Before I dive into this too far, has anybody already written some code which formats times like that?
[toc] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2012-11-20 12:16 -0600 |
| Message-ID | <mailman.76.1353435321.29569.python-list@python.org> |
| In reply to | #33630 |
On 11/20/12 10:18, Roy Smith wrote: > I need to talk to an API which requires (for reasons totally beyond my > comprehension), time specified in "at" format, i.e. the format > accepted by the unix "at" command. This allows you to do such bizarre > things as use "teatime" to indicate 4:00 PM. The best I can find for > a specification is http://tinyurl.com/d5vddoa. > > Before I dive into this too far, has anybody already written some code > which formats times like that? Your statement can be ambiguously parsed as "I need to merely *generate* time specifications that 'at' can parse", or it can be parsed as "I need to generate *and consume* time specifications the same way as 'at' does" If it's the former, it's pretty easy--'at' accepts a wide variety of formats. If it's the latter, I've got a doc in /usr/share/doc/at/timespec on my Debian machine, which seems to be googleable, but here's one copy of it http://fts.ifac.cnr.it/cgi-bin/dwww/usr/share/doc/at/timespec I don't have a parser already, but that should get you a jump start on what (at least Debian's) 'at' parses, and might tie nicely with pyparsing. -tkc
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2012-11-20 13:24 -0500 |
| Message-ID | <mailman.78.1353435864.29569.python-list@python.org> |
| In reply to | #33630 |
On Nov 20, 2012, at 1:16 PM, Tim Chase wrote: > Your statement can be ambiguously parsed as "I need to merely > *generate* time specifications that 'at' can parse", or it can be > parsed as "I need to generate *and consume* time specifications the > same way as 'at' does" > > If it's the former, it's pretty easy--'at' accepts a wide variety of > formats. Fortunately, it's the former. Since posting my original query, I have discovered by experimentation that the API also accepts a string of digits as a unix timestamp, so this turns out to be trivial. --- Roy Smith roy@panix.com
[toc] | [prev] | [next] | [standalone]
| From | Hans Mulder <hansmu@xs4all.nl> |
|---|---|
| Date | 2012-11-21 13:14 +0100 |
| Message-ID | <50acc5a9$0$6940$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #33630 |
On 20/11/12 17:18:33, Roy Smith wrote:
> I need to talk to an API which requires (for reasons totally beyond my
> comprehension), time specified in "at" format, i.e. the format
> accepted by the unix "at" command. This allows you to do such bizarre
> things as use "teatime" to indicate 4:00 PM. The best I can find for
> a specification is http://tinyurl.com/d5vddoa.
>
> Before I dive into this too far, has anybody already written some code
> which formats times like that?
On my machine x.strftime("%H:%m %d.%m.%Y") formats datetime objects
in a format that at(1) understands:
$ > at -f my_job '12:11 21.11.2012'
at: trying to travel back in time
Hope this helps,
-- HansM
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web