Mail Archives: djgpp/1996/02/08/11:35:38
On Thu, 8 Feb 1996, John Carter wrote:
> I tried using rawclock() for nefarious purposes and got 0 for my
> pains. Looking at the source for rawclock left me dead, it seems to
> do, (what I would guess is an unsafe practice), a far peek into some
> part of dos memory.
>
> Any suggestions as to what I am doing wrong?
Nothing's wrong. `rawclock' just returns the number of the clock ticks
since the first call, which means it returns zero on the first call. On
subsequent calls you should see non-zero return values.
This seems to me as a documentation bug (because the docs say it should
return the number of ticks since midnight).
The `_farpeek' call just looks at the absolute address in the BIOS area
where the current clock tick is kept.
> Should I rewrite rawclock to try a more standard approach via the
> interrupt calls?
You don't need to. There is a library function called `_bios_timeofday'
which does just that. Look it up in the docs.
- Raw text -