Mail Archives: djgpp/2001/06/15/19:45:17
Thu, 14 Jun 2001, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
>> >> Is DOS _really_ so slow?
>> DD> No, but consider that Unix keeps track of the time *as* a time_t, so
>> DD> time() merely reads a number from memory and returns it - a few CPU
>> DD> cycles at best. DOS, however, uses the hardware realtime clock, so it
>> DD> must convert month/day/year/hour/minute/second/timezone to a time_t
>> DD> each time you need to know what time it is. The conversion is slow.
>> Well, but why time() simply not caches this values (month/day/year/
>> hour/minute/second/timezone) (such as Linux kernel does)?
EZ> This is not as simple as it sounds. You cannot know whether a second
EZ> passed without asking DOS, and you cannot even rely on the timezone
But I need to ask DOS anyway :). I'll only save some amount of CPU time
because I will not calculate seconds since 1970 every time() call...
EZ> being fixed, because the user can change the value of TZ in the
EZ> environment.
AFAIR, user must call tzset() anyway, to apply TZ changes...
EZ> Even if you do cache the time for one second, you cannot simply add
EZ> seconds to the previous value of time_t, since the user can change the
EZ> system clock.
If user changes system clock then cached values will be quite different
from current values. I want only avoid expensive calculating, not int21
calling...
EZ> But if you have specific changes in mind, please send in patches
EZ> (please post them to djgpp-workers AT delorie DOT com).
Well, I'll try this. Need I patch 2.03 or some newer (alpha?) version?
- Raw text -