uclock () sometimes return negative values. i've made patch for rtc8254, but
not fot rtc8253:
*** 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;
actually i don't know if there are any 386 or higher PCs that using rtc8253.
it works for me and all my boards and i happy :-)