date_parse - date parsing routine and programs
version 1.8 of 05mar98
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
wdy, DD-mth-YY HH:MM:SS ampm zone
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:
o date_sort - sort a file's lines by date
o date_order - order a list of files by netnews/mail-format Date: lines
o deltime - subtract two times and show the difference
o timegraph - graph or histogram time-based data
o xmit_time - figure transmission time of netnews articles
See the manual entries for more details.
To install:
Unpack the files.
Edit the Makefile to change the configuration options if necessary.
Make test to check that it works right.
Make install.
Comments to:
Jef Poskanzer jef@acme.com http://www.acme.com/jef/