workaround for common programming error involving ctime and localtime
Arthur David Olson
ado
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 4.12.3.2...
The ctime funciton converts the calendar time pointed to by timer
to local time in the form of a string. It is equivalent to
asctime(localtime(timer))
...do we open ourselves up to standard conformance challenges if ctime is
anything except "asctime(localtime(timer))"?
--ado
More information about the tz
mailing list