date_parse - date-parsing routine and apps

Fetch the software.

For a while now I've been somewhat unhappy with the various date-parsing routines available - yacc-based, lex-based, ad-hoc. Large code size and not very portable are the main complaints. So I wrote a new one that just does a bunch of sscanf's until one matches. Slow, but small and portable. To figure out what formats to support I did a survey of Date: lines in a bunch of Usenet articles. The following two formats accounted for more than 99% of all articles:


    DD mth YY HH:MM:SS ampm zone
    wdy, DD mth YY HH:MM:SS ampm zone
    

I added Unix ctime() format and a few others:


    wdy mth DD HH:MM:SS ampm zone YY
    HH:MM:SS ampm zone DD mth YY
    DD mth YY
    HH:MM:SS ampm
    

No-zone, no-seconds, and no-am/pm versions of each are also supported. Note that dd/mm/yy and mm/dd/yy are NOT supported - those formats are dumb.

Aside from the date-parsing routine, this package includes some programs that exercise it:

See the manual entries for more details. For some sample runs of the timegraph command, check out the ACME Labs web stats page.


ACME Labs / Software / date_parse
email