Mail Archives: djgpp/2002/10/12/16:45:44
> >> 2) getenv heavily used by timer functions for timezone info
> >> (TZ, TZDIR, etc. - seems things are stored in static
> >> variables but probably not in all places?)
> > Only once: the time functions cache the values of environment
> > variables. If your program changes the environment a lot (by calling
> > putenv or setenv, for example), then caching could be ineffective,
> > since each time the environment changes, time functions must see if
> > some of their variables changed as well, and take note. This is so
> > that setting TZ to a different value is correctly handled.
> The profile shows - each tzset force calling tzsetwall
> (TZ variable is not set in my environment).
Have you tried setting TZ to see if the profile changes/improves?
A casual inspection of ctime.c (I'm not an expert) looks like to me that
at least the first comparison of lcl_is_set should be !=0 instead of >0
to cache the case where TZ is not set. You could try modifying ctime.c
in such a manner to see if it improves performance (and still works).
- Raw text -