Date: Thu, 27 Aug 1998 20:15:55 +0400 (MSD) From: "Alexander S. Aganichev" To: djgpp AT delorie DOT com Subject: uclock () Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Greencity'ngs, dear all! During debugging my program i found that in rare conditions return value of second call to uclock is lesser than first. I made patch, that works on all my boards, but I'm still unsure if *ALL* PC with i386 or higher contains RTC8254. Could anyone comment my patch, so i could rebuild all my applications with patched library? *** uclock.c Thu Jan 25 21:39:06 1996 --- uclock.new Mon Aug 3 14:13:12 1998 *************** *** 20,26 **** { static uclock_t base = 0; static unsigned long last_tics = 0; ! unsigned char lsb, msb; unsigned long tics, otics; uclock_t rv; --- 20,26 ---- { static uclock_t base = 0; static unsigned long last_tics = 0; ! unsigned char lsb, msb, status; unsigned long tics, otics; uclock_t rv; *************** *** 41,51 **** /* Make sure the numbers we get are consistent */ do { otics = _farpeekl(_dos_ds, 0x46c); ! outportb(0x43, 0x00); lsb = inportb(0x40); msb = inportb(0x40); tics = _farpeekl(_dos_ds, 0x46c); ! } while (otics != tics); /* calculate absolute time */ msb ^= 0xff; --- 41,52 ---- /* Make sure the numbers we get are consistent */ do { otics = _farpeekl(_dos_ds, 0x46c); ! outportb(0x43, 0xd0); ! status = inportb(0x40); lsb = inportb(0x40); msb = inportb(0x40); tics = _farpeekl(_dos_ds, 0x46c); ! } while ((otics != tics) && (status & 0x40)); /* calculate absolute time */ msb ^= 0xff; Signed Alex. S. Aganichev