home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name UTGETCLK -- Read BIOS clock tick count.
- *
- * Synopsis rollover = utgetclk(pcount);
- *
- * int rollover 1 if midnight rollover occurred
- * on the most recent clock tick;
- * 0 if not.
- * long *pcount The count of timer ticks since
- * midnight.
- *
- * Description This function returns the BIOS's four-byte count of
- * clock ticks since midnight. On standard IBM PCs, timer
- * ticks occur 1193180/65536 (about 18.2) times per second.
- *
- * If the value of the function is 1, then the midnight
- * rollover has occurred but has not yet been cleared.
- * This function does NOT clear the rollover flag, thus
- * allowing another program (presumably DOS) to respond to
- * the rollover and to clear it.
- *
- * Returns rollover 1 if midnight rollover occurred
- * on the most recent clock tick;
- * 0 if not.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1986,1987,1989
- *
- **/
-
-
- #include <butil.h>
-
-
- int utgetclk(pcount)
- long *pcount;
- {
- int were_on; /* Stores previous interrupt state. */
- unsigned char rollover; /* Copy of BIOS's rollover flag. */
-
- were_on = utintoff(); /* Turn interrupts off. */
-
- utpeekn ((char far *) UTCLOCKADDR,
- (void *) pcount,
- sizeof (*pcount));
-
- rollover = utpeekb (UTROLLADDR);
-
- if (were_on)
- utinton(); /* Turn interrupts back on. */
-
- return (rollover != 0);
- }