www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/22/22:24:00

Date: Sun, 22 Sep 1996 21:49:09 -0400
From: dj (DJ Delorie)
Message-Id: <199609230149.VAA28169@delorie.com>
To: tomss AT ids DOT net
CC: djgpp AT delorie DOT com
In-reply-to: <Pine.SUN.3.95.960922200128.857C-100000@conan.ids.net> (message from Tom Sgouros on Sun, 22 Sep 1996 20:04:19 -0400)
Subject: Re: PC Time

> Can anyone clear up for me the real-time issues on a PC? This is how I
> understand it: There is a clock that ticks 18.2 times a second, and though
> there are functions that provide more precision (e.g. uclock()), they
> are no more accurate. Is this true?

This is not true.

There is one clock in a PC and it ticks (effectively) 1,193,180 times
a second (UCLOCKS_PER_SEC in <time.h>).

A counter divides that by 65,536 to give you 18.2065 interrupts per
second.  clock() multiplies this by five to give an integer
approximate for CLOCKS_PER_SEC of 91.

uclock() reads both the divide counter and the tick counter to give
you 0.838 microsecond accuracy.

P.S.  Before anyone argues my numbers, note that this is based on the
FAQ of 0x1800b0 tics per day, and the counter is reprogrammed for mode
2 operation.

- Raw text -


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