delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/10/24/17:31:44

Date: Sun, 24 Oct 1999 16:10:32 -0500
From: Eric Rudd <rudd AT cyberoptics DOT com>
Subject: Re: new uclock.c (with Windows VTD.VXD support)
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp-workers AT delorie DOT com
Message-id: <381375C8.B166FF3B@cyberoptics.com>
Organization: CyberOptics
MIME-version: 1.0
X-Mailer: Mozilla 4.08 [en] (Win95; U)
References: <Pine DOT SUN DOT 3 DOT 91 DOT 991024092359 DOT 29385F AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:

> > > /* tics = about 18.2 * 65536 (1,192,755)
> > >
> > >    actually, it's   0x1800b0 tics/day (FAQ)
> > >                   / 24*60*60 sec/day
> > >                   * 65536 utics/tic
> > >                   = 1,193,180 utics/sec */

> I want to be sure I understand what you are saying.  The facts you described are
> mostly known (we even had a thread not so long ago on c.o.m.d. about this), but
> what are you saying in practice?  Is the above formula (due to DJ, btw)
> incorrect?  If so, how it should be corrected, in your opinion?

I searched deja.com just now for "NTSC" and also for "subcarrier", but didn't see
any relevant messages.  It looked as if someone took the figure 0x1800B0 (actually
closer to 0x1800B2) to be the ultimate specification of the clock rate, and worked
his way back to the figure 1,193,180 utics/sec (actuall 105E6/88 utics/sec), but it
is actually sort of the other way around.  I would simply have quoted the utic
frequency as 105/88 MHz.

> > Somewhere in the docs is the statement that there are 65536 ticks
> > per hour.  This is very close, but not quite correct, as one can
> > verify with a calculator given the above facts.
>
> I don't see this number anywhere in libc.info, neither in v2.02 nor in
> the latest alpha of v2.03.  There's a number 65543.33 in the docs of
> _bios_timeofday, but that's all.

It's from time.h:

#ifndef __dj_ENFORCE_ANSI_FREESTANDING

/* 65536(tics/hour) / 3600(sec/hour) * 5(scale) = 91.02
   The 5 is to make it a whole number (18.2*5=91) so that
   floating point ops aren't required to use it. */
#define CLOCKS_PER_SEC  91

> There's a number 65543.33 in the docs of _bios_timeofday, but that's all.

And that figure should really be more like 65543.43.

None of these differences have much practical importance, since most PC clocks are
not accurate to 2 PPM anyway, but I thought there was some merit in helping people
understand where these peculiar fractions really come from.  I also though that one
might as well quote the simple, mathematically-exact fractions, rather than the
complicated, inexact decimal equivalents.

-Eric

- Raw text -


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