Victor Bazarov wrote:
Flzw wrote:
Is there a standard library (C or C++) to convert a time in seconds
since Jan, 1st 1970 into a formatted datetime string ?
No. Standard calendar time doesn't necessarily represent the number of
seconds since Jan 1st, 1970. However, there are standard functions to
convert standard calendar time value into a string. See 'asctime'.
What FM do you R (as in RTFM) on the regular basis that doesn't describe
'asctime' among other standard time functions?
Not everyone learns from FMs. Even so, I don't know if they all have
adequate indexes. And even so, asctime doesn't answer the OP's question.
FWIW, the relevant man page on my (Mac OS X) box gives
"The functions ctime(), gmtime() and localtime() all take as an argument
a time value representing the time in seconds since the Epoch (00:00:00
UTC, January 1, 1970; see time(3))."
Does this mean that it's describing the local implementation rather than
the standard? It also mentions that asctime works with struct tm, not
with standard calendar time values; the equivalent function for working
with the latter is ctime.
Moreover, the OP might be wanting some control over the format, or
(which would be OT here) to use the OS-configured format. I for one
would certainly choose either over the peculiar Www Mmm dd hh:mm:ss yyyy
format I'm made to wonder where came from.
Stewart.
--
My e-mail is valid but not my primary mailbox. Please keep replies on
the 'group where everyone may benefit.