Printing time in "at" format?

Tim Chase python.list at tim.thechases.com
Tue Nov 20 13:16:05 EST 2012


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





More information about the Python-list mailing list