_bios_timeofday
raw OCR
Reads or sets the BIOS timer.
Defined in header <bios.h>
Syntax
#include <bios.h>
unsigned _bios_timeofday(int cmd, long *timep);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
_bios_timeofday either reads or sets the BIOS timer. This is a timer counting ticks since midnight at a rate of roughly 18.2 ticks per second. _bios_timeofday uses BIOS interrupt OxlA.
The cmd parameter can be either of the following values:
| _TIME_GETCLOCK | The functions stores the current BIOS timer value into the location pointed to by timep. If the timer has not been read or written since midnight, the function returns 1. Otherwise, the function returns 0. |
| TIME SETCLOCK | The function sets the BIOS timer to the long value pointed to by timep. The function does not return a value. |
Return value
The _bios_timeofday returns the value in AX that was set by the BIOS timer call.
Example
#include <bios.h>
#include <time.h>
#include <conio.h>
int main(void)
{
long bios_time;
clrscr0 ;
cprintfC'The number of clock ticks since midnight is:\r\n"
cprintfC'The number of seconds since midnight is:\r\n
cprintfC'The number of minutes since midnight is:\r\n
cprintfC'The number of hours since midnight is:\r\n")
cprintf("\r\nPress any key to quit:");
whiledkbhitO) {
_bios_timeofday(_TIME_GETCLOCK, &bios_time);
gotoxy(50, 1);
cprintf("%lu" ,bios time) ;
gotoxy(50, 2) ;
cprintf("%.4f ' bios_time / CLK_TCK);
gotoxy(50, 3) ;
cprintf("%.4f" bios_time / CLK_TCK / 60);
gotoxy(50, 4);
cprintf("%.4f" bios_time / CLK_TCK / 3600)
return
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/bios.h/_bios_timeofday/
· short form /3.1/_bios_timeofday/