Mail Archives: djgpp/2002/10/13/01:59:56
On Sat, 12 Oct 2002, Leonid Pauzner wrote:
> > In general, time functions _are_ heavy, since the computations are
> > non-trivial and require iterations in some cases. You shoulod try to
> > avoid calling time functions in inner loops of your program.
>
> That is about clock()/CLOCKS_PER_SECOND - is it portable across UNIXes
> and shows correct number of seconds in true multitasking environment?
Yes, `clock' is an ANSI standard function, so every Unix platform
nowadays should have it.
> Just indexing by the first letter of the environment variable name
> may speeds up getenv by the factor of 10.
If you can come up with a patch to getenv that speeds it up tenfold, I'm
sure it will be gratefully accepted.
> > 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.
>
> No!
> The profile shows - each tzset force calling tzsetwall
> (TZ variable is not set in my environment).
Then do set TZ. Every well-set DJGPP installation should have TZ set to
something appropriate, especially if you are running Unix programs.
- Raw text -