diff --git a/usr.bin/doscmd/timer.c b/usr.bin/doscmd/timer.c index a91c8d106cf2..7f40725ede87 100644 --- a/usr.bin/doscmd/timer.c +++ b/usr.bin/doscmd/timer.c @@ -8,16 +8,11 @@ static void int08(regcontext_t *REGS) { - struct timeval tv; - time_t tv_sec; - struct timezone tz; - struct tm tm; - - gettimeofday(&tv, &tz); - tv_sec = tv.tv_sec; - tm = *localtime(&tv_sec); - *(u_long *)&BIOSDATA[0x6c] = - (((tm.tm_hour * 60 + tm.tm_min) * 60) + tm.tm_sec) * 182 / 10; + *(u_long *)&BIOSDATA[0x6c] += 1; /* ticks since midnight */ + while (*(u_long *)&BIOSDATA[0x6c] >= 24*60*6*182) { + *(u_long *)&BIOSDATA[0x6c] -= 24*60*6*182; + BIOSDATA[0x70]++; /* # times past mn */ + } softint(0x1c); } @@ -40,6 +35,10 @@ timer_init(void) { u_long vec; struct itimerval itv; + struct timeval tv; + time_t tv_sec; + struct timezone tz; + struct tm tm; vec = insert_hardint_trampoline(); ivec[0x08] = vec; @@ -52,6 +51,13 @@ timer_init(void) define_input_port_handler(0x42, inb_timer); define_input_port_handler(0x40, inb_timer); + /* Initialize time counter BIOS variable. */ + gettimeofday(&tv, &tz); + tv_sec = tv.tv_sec; + tm = *localtime(&tv_sec); + *(u_long *)&BIOSDATA[0x6c] = + (((tm.tm_hour * 60 + tm.tm_min) * 60) + tm.tm_sec) * 182 / 10; + itv.it_interval.tv_sec = 0; itv.it_interval.tv_usec = 54925; /* 1193182/65536 times per second */ itv.it_value.tv_sec = 0; diff --git a/usr.bin/doscmd/tty.c b/usr.bin/doscmd/tty.c index 23486cc5940d..356fef73a98a 100644 --- a/usr.bin/doscmd/tty.c +++ b/usr.bin/doscmd/tty.c @@ -373,14 +373,6 @@ video_update(regcontext_t *REGS) else video_update_text(); } - - if (!booting) { - *(u_long *)&BIOSDATA[0x6c] += 1; /* ticks since midnight */ - while (*(u_long *)&BIOSDATA[0x6c] >= 24*60*6*182) { - *(u_long *)&BIOSDATA[0x6c] -= 24*60*6*182; - BIOSDATA[0x70]++; /* # times past mn */ - } - } #endif }