biostime
raw OCR
Reads or sets the BIOS timer.
Defined in header <bios.h>
Syntax
#include <bios.h>
long biostime(int cmd, long newtime);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
biostime 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, biostime uses BIOS interrupt 0x1 A.
If cmd equals 0, biostime returns the current value of the timer.
If cmd equals 1, the timer is set to the long value in newtime.
Return value
When biostime reads the BIOS timer {cmd - 0), it returns the timer's current value.
Example
#include <bios.h>
#include <time.h>
#include <conio.h>
int main(void)
{
long bios_time;
clrscrO;
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_time = bbiostime(0, 0L);
gotoxy (50,1)
cprintf ("%lu" bios_time) ;
gotoxy (50,2)
cprintf ("%At , 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/biostime/
· short form /3.1/biostime/