From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10206101857.AA21195@clio.rice.edu> Subject: Re: uclock() on Win2K To: acottrel AT ihug DOT com DOT au (Andrew Cottrell) Date: Mon, 10 Jun 2002 13:57:37 -0500 (CDT) Cc: djgpp-workers AT delorie DOT com In-Reply-To: <004901c2104a$6d9e7240$0102a8c0@acceleron> from "Andrew Cottrell" at Jun 10, 2002 04:45:05 PM X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Charles as you indicated in the first email Windows virtualised the TOD > tick, so why not use the virtualised TOD tick on Windows NT/2K/XP instead of > the timer registers? Precision. The timer tick is 18 times per second, but we are looking for millisecond (or better) resolution. We can get the timer tick, and we can get the timer registers, but pulling them together in a consistent manner seems to be a challenge. The timer tick in the bios is roughly correct (and works) - but it seems it can drift a few milliseconds each time it's set. So if you get a BIOS tick counter plus timer registers, unless you are far from the tick changeover threshold you may get the time wrong by up to a 1/18 of a second. In DOS or Win9x the tic changes when the MSB timer counter passes zero. In Win2K the two events are not related (it may happen when the timer msb counter is 230, for example, with a range of 225 to 255 ). So, if you enter uclock() and see timer register msb=230, did the clock tick in the bios already happen, or will it happen soon? Unless you have uclock delay to get far away from the threshold (which screws up timing things with it) you can never be sure.