workaround for common programming error involving ctime and localtime
Arthur David Olson
Wed May 11 19:35:52 UTC 1994
> ! /*
> ! ** The following is equivalent to `return asctime(localtime(timep));',
> ! ** except it does not modify localtime's static storage,
> ! ** and thus it works around all-too-common bugs like
> ! ** `struct tm *p = localtime(&t1); puts(ctime(&t2)); return p->tm_year'.
> ! */
Hmmm...given the X3J11 description of ctime in section 18.104.22.168...
The ctime funciton converts the calendar time pointed to by timer
to local time in the form of a string. It is equivalent to
...do we open ourselves up to standard conformance challenges if ctime is
anything except "asctime(localtime(timer))"?
More information about the tz