Mail Archives: djgpp/1997/08/19/16:04:31
A. Sinan Unur wrote:
> you seem to be right about this. if the counter at 0x46c resets at
> midnight, you will get erronous results. one workaround might be to do
> the following:
>
> unsigned long
> rawclock(void)
> {
> static unsigned long base = 0;
> unsigned long rv;
> rv = _farpeekl(_dos_ds, 0x46c);
> if (base == 0)
> base = rv;
> if( rv < base ) /* see if the counter has reset */
> {
> rv += ULONG_MAX - base; /* adjust ticks elapsed */
> base = rv - (ULONG_MAX - base); /* adjust base */
> }
>
> return rv - base;
> }
>
> would this be acceptable?
> --
> Sinan
Yes, that looks to me like a way to fix rawclock(). I'll try something
like it. Maybe the midnight bug doesn't bother most folks, but I do
most of my programming in the wee hours, when the wee ones are in bed.
<grin>
--
"There is no theory. You have merely to listen. Fantasy is the law."
-- Claude Debussey
Remove the ".nospam" to reply by email.
- Raw text -