the parser is in -last tmxdate()
its add-hoc (no formal grammar)
it does have extensive regression tests to make sure add-hoc changes retain old 
behavior

1000 was indeed a magic number
its in the part that handles these { date(1) touch(1) } formats:
        [[cc]yy[mm]]ddhhmm[.ss[.nn...]]
        [cc]yyjjj
        hhmm[.ss[.nn...]]
I added a one word lookahead for a part-of-time word { second minute hour day 
week month year }
if present it allows any positive integer
this change handles all of your examples

this will be in the next update
thanks for the detailed examples

On Thu, 29 Dec 2011 18:03:51 +0800 Clark J. Wang wrote:
> I find that printf's `%T' format can recognize time strings like "2 days
> ago" or "10 hours later" which is really cool. But then I find that 1000 is
> a magic number for %T. See following examples:

> $ echo ${.sh.version}
> Version jM 93u 2011-02-08
> $ printf '%T\n' '1000 days ago'
> Wed Dec 28 10:00:00 CST 2011
> $ printf '%T\n' '1000 minutes ago'
> Thu Dec 29 09:59:00 CST 2011
> $ printf '%T\n' '1000 seconds ago'
> ksh: printf: warning: invalid argument of type T    <-- ???
> Thu Dec 29 10:00:00 CST 2011
> $
> $ printf '%T\n' '201201010101.01 999 days ago'
> Tue Apr  7 01:01:01 CST 2009
> $ printf '%T\n' '201201010101.01 1000 days ago'
> ksh: printf: warning: invalid argument of type T    <-- ???
> Sun Jan  1 01:01:01 CST 2012
> $

> I'm confused. Is there a specification about the exact time strings
> supported by ksh?

> -Clark

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to