generic time parsing functions, getdate() DATEMSK examples, and strptime()
From: Paul Sheer (psheer_at_WITHOUTicon.co.za)
Date: 01/29/05
- Next message: jimi_xyz_at_hotmail.com: "unix local domain, signals, and locking help!"
- Previous message: Average Joe: "Re: ncurses getch SIGWINCH"
- Next in thread: Martin Blume: "Re: generic time parsing functions, getdate() DATEMSK examples, and strptime()"
- Reply: Martin Blume: "Re: generic time parsing functions, getdate() DATEMSK examples, and strptime()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 Jan 2005 18:25:03 +0200
I would like a function that parses an ascii string
into a struct tm. The function should support a
variety of time formats for a variety of locales.
It should not only parse the time, but determine
what standard of format has been given.
It seems silly that no such function has yet been
written. Is it not possible? or is there some
reason why one would never want to do this?
Currently there are a variety of date formats like
ISO, W3C, RFC822, asctime() and others. If I don't
know what kind of time format I am going to get,
I would like the function to tell me,
as well as the locale. If there is an
ambiguity, to indicate a list of probable
formats ordered by likelihood. The latter is a
tall order, I know, but a nice-to-have. The
function should also understand all known time-zone
abbreviations and return the GMT offset if possible.
If the time format seems to have missing offset
information, then this should be indicated as a
warning.
Alternatively, the getdate() man page mentions
a DATEMSK envvar that points to a file. Where can
I get an example of such a file that contains all
the common time formats in use? This would mostly
solve my problem.
Note that I have read the man pages: localtime(3),
strftime(3), strptime(3), time(3), date(1),
gettimeofday(2), newctime(3), time(2), utime(2),
clock(3), difftime(3), strftime(3), tzset(3),
getdate().
(Also, to really be useful, the source for this
function must be available in both Pascal, Java,
and ANSI-C. And it must also have a reverse
function.)
Thanks for any help!
-paul
- Next message: jimi_xyz_at_hotmail.com: "unix local domain, signals, and locking help!"
- Previous message: Average Joe: "Re: ncurses getch SIGWINCH"
- Next in thread: Martin Blume: "Re: generic time parsing functions, getdate() DATEMSK examples, and strptime()"
- Reply: Martin Blume: "Re: generic time parsing functions, getdate() DATEMSK examples, and strptime()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|