home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
progjorn
/
pj_6_1.arc
/
LISTING1.C
< prev
next >
Wrap
Text File
|
1987-12-28
|
896b
|
26 lines
/*
* gettime.c -- Uses BIOS interrupt 0x1A to get the timer count
* in clock ticks.
* Copyright Frank D. Greco, 1987
* Page 50, Volume 6.1 Programmer's Journal
*/
#include <dos.h>
#define TOD_INT 0x1a
unsigned long gettime()
{
union REGS in, out;
unsigned long current_tix; /* 32-bit tick value to be returned */
in.h.ah = 0; /* AH = 0 GET clock ticks */
int86(TOD_INT, &in, &out); /* Call BIOS timer tick interrupt */
current_tix = ( (long) out.x.cx << 16 ) + out.x.dx;
/* If midnite passes, add a day's worth of clock tix to the return value */
return ( out.x.ax & 0xff ) ? current_tix += 0x01800b0L: current_tix;
}