_bios_timeofday

Description

Calls BIOS time and date services, using INT 0x1A.

#include <bios.h>

unsigned _bios_timeofday( unsigned service, long *timeval );

service Time function desired  
timeval Clock count  

Remarks

The _bios_timeofday routine uses INT 0x1A to get or set the clock count. The service argument can be either of the following manifest constants:

Constant Meaning

_TIME_GETCLOCK Copies the current value of the clock count to the location pointed to by timeval. If midnight has not passed since the last time the system clock was read or set, the function returns 0; otherwise, the function returns 1.
_TIME_SETCLOCK Sets the current value of the system clock to the value in the location pointed to by timeval. There is no return value.

Return Value

The _bios_timeofday function returns the value in the AX register after the BIOS interrupt.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

Example

/* BTIMEOFD.C: This program gets the current system clock count before and after

* a "do-nothing" loop and displays the difference.

*/

#include <bios.h>

#include <stdio.h>

void main( void )

{

long i, begin_tick, end_tick;

_bios_timeofday( _TIME_GETCLOCK, &begin_tick );

printf( "Beginning tick count: %lu\n", begin_tick );

for( i = 1; i <= 900000; i++ )

;

_bios_timeofday( _TIME_GETCLOCK, &end_tick );

printf( "Ending tick count: %lu\n", end_tick );

printf( "Elapsed ticks: %lu\n", end_tick - begin_tick );

}

Output

Beginning tick count: 1114255

Ending tick count: 1114287

Elapsed ticks: 32