www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/08/11:35:38

Date: Thu, 8 Feb 1996 18:24:26 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: John Carter <ECE AT dwaf-hri DOT pwv DOT gov DOT za>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu, dj AT delorie DOT com
Subject: Re: Rawclock?

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019