Questionable optimization of localtime(3) in 4.3BSD?

Per Hedeland per at erix.UUCP
Tue Mar 1 21:19:15 AEST 1988


Between 4.2 and 4.3, localtime(3) was optimized by giving it a "memory", so
it wouldn't have to gettimeofday(2) to obtain the timezone info on each call.
However, one result of this is that /usr/ucb/lisp as distributed will always
give the time in LBT (Local Berkeley Time).  Of course, remaking it "solves"
the problem by hardwiring in one's own local timezone.

I gather that this behaviour is essentially unchanged by the new ctime
package posted to .ucb-fixes. Is there a "good" solution to this problem?
I guess the simplest way out is just to decree that packages creating
executables by dumping mustn't call localtime/ctime before the dump...

Yours for side-effect-free functions :-)
Per Hedeland
per at erix.ericsson.se  or  ...{mcvax,uunet}!enea!erix!per



More information about the Comp.bugs.4bsd.ucb-fixes mailing list