Path: utzoo!attcan!uunet!cs.utexas.edu!mailrus!sharkey!inquiry!shadooby!egrunix!nucleus!dar From: dar@nucleus.UUCP (Dario Alcocer) Newsgroups: comp.sys.ibm.pc Subject: Re: getting the time Summary: BIOS clock ticks & time Message-ID: <5487@nucleus.UUCP> Date: 20 Nov 89 18:29:36 GMT References: <17118@netnews.upenn.edu> Organization: The Nucleus Public Access Unix, Clarkston, MI Lines: 33 In article <17118@netnews.upenn.edu>, hardt@linc.cis.upenn.edu (Dan Hardt) writes: > A friend needs to read the time for a real-time application. > We tried using some Microsoft C functions for reading the > clock. The functions returned the time down to the hundredth > of a second -- but they don't seem to notice any change in the > time less than 5/100 of a second or so. If we have a loop which > continually checks the time, its values are ,eg, > 0,0,0,0,5,5,5,5,5,11,11,11,etc > Why is this? Any way to get a more fine-grained access to the time? If i'm not mistaken, it seems that the functions you are using are getting the BIOS clock ticks since midnight (this value is used in INT 21h, 2Ch: DOS Get System Time). The BIOS clock tick count is available at 0040:006C. Since the BIOS clock tick count is incremented by INT 8, which is called approximately 18 times per second, the granularity of the clock tick count is ~1/18 sec, which is roughly equal to 5/100 sec. To have smaller granularity would require you to reprogram the timer chip, and I have seen it done before, although I have no code that does this. Maybe someone else has done it, and could share this with you. Hasta... dario. +==================================================================+ | + | | Dario Alcocer (San Diego, CA) | Internet......dar@nucleus.mi.org | | via Nucleus | phone...............619-450-1667 | | + | +==================================================================+