🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4007

Re: Fixed clock speed on pc? CLK_TCK == 18.2 is TRUE??

#4007
From: apm233m
Date: Fri, 21 Dec 1990 00:12
37 lines
2296 bytes
In article <15779.2770e40e@levels.sait.edu.au>, marwk@levels.sait.edu.au writes:
> In time.h in TURBO C 2.0 CLK_TCK is defined to be 18.2.
> 
> Should I alter this depending on the speed of the processor, RAM speed
> etc., or is there a specific clock on the PC/AT/386,..., that always
> ticks away at the same speed, namely 18.2 times/second?

I don't know why CLK_TCK is defined in time.h, but the nominal 18.2 "ticks" per
second should be the same on all machines running MS-DOS.

MS-DOS (and PC-DOS etc) have a time-of-day clock. The PC BIOS is interrupt-
driven by a programmable hardware timer running at 18.2 interrupts per
second. This rate is independent of the processor type (8088/80286/80386/etc).
MS-DOS gets the time-of-day from a count of the number of ticks since midnight
which is maintained by BIOS. (I think that it is possible to change this
behaviour of MS-DOS, e.g. by way of an installable driver, but this would
not remove the requirement that the BIOS maintains a correct count - other
programs besides MS-DOS itself can use the BIOS tick count.)

It is possible to perform tricks with the hardware timer to make it run faster,
but you must make sure that the counter which is maintained by bios is
correct whenever it is read. The easiest way of doing this is to make sure that
the BIOS timer interrupt routines are called at the correct rate of 18.2 ticks
per second.

As mentionded above, in addition to the use which MS-DOS makes of the clock
ticks, some programs will use the timer for timing purposes and these programs
will break if the tick rate is changed.

Turbo-C provides the biostime() function for setting and reading the BIOS
tick count.

----------------------------------------------
Bill Metzenthen
Mathematics Department
Monash University
Melbourne, Australia
Technical Details
Message-ID: <82583.2771ee24@vaxc.cc.monash.edu.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!bruce!monu1!vaxc!apm233m
References: <15779.2770e40e@levels.sait.edu.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!bruce!monu1!vaxc!apm233m
From: apm233m@vaxc.cc.monash.edu.au
Newsgroups: comp.os.msdos.programmer
Subject: Re: Fixed clock speed on pc?  CLK_TCK == 18.2 is TRUE??
Message-ID: <82583.2771ee24@vaxc.cc.monash.edu.au>
Date: 21 Dec 90 00:12:36 GMT
References: <15779.2770e40e@levels.sait.edu.au>
Organization: Computer Centre, Monash University, Australia
Lines: 37