| www.delorie.com/djgpp/mail-archives/browse.cgi | search |
| From: | Kevin Ashley <k DOT ashley AT ulcc DOT ac DOT uk> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Converting an ascii time to time_t |
| Date: | Wed, 22 Nov 2000 17:12:41 +0000 |
| Organization: | Posted via ULCC Internet Services |
| Lines: | 28 |
| Message-ID: | <3A1BFE89.41C6@ulcc.ac.uk> |
| References: | <j05n0t8b87cjho4ul7pdfkpd2th4u6pg78 AT 4ax DOT com> |
| NNTP-Posting-Host: | mercury.ulcc.ac.uk |
| Mime-Version: | 1.0 |
| X-Mailer: | Mozilla 3.01 (X11; I; IRIX 6.5 IP22) |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |