Mail Archives: djgpp/2000/11/22/19:06:17
Damian Yerrick wrote:
>
> How can a DJGPP program convert two different time formats to time_t,
> using POSIX functions?
>
> The first source gives "Was last logged in: Fri Nov 10 2000"
> The second source gives "2000-05-14"
For many years I've used some code snarfed from innlib to do this.
parsedate.y is a simple yacc routine which parses a variety of date/time
formats. It also handles exotica like "last month" and "next wednesday"
which make it very suitable for handling human date input.
For my local use, I modified it slightly to add a reduction for ISO date
formats (the second one you give above) and to modify the rules for
ambiguous all-numeric dates to prefer general custom to US custom (i.e.
assume dd/mm/yy rather than mm/dd/yy). It also needed a couple of #ifdef's
to allow it to be built alone, rather than requiring a raft of header files
from the rest of INN to build.
If you can't locate it yourself, drop me email and I'll send you my modified
copy.
------------------------------------------------------------------------------
Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk
Digital Preservation Manager http://www.ulcc.ac.uk/staff/Kevin+Ashley
ULCC ...ukc!ncdlab!K.Ashley (but probably not any more)
This is not a signature
- Raw text -