Availability | All terminals | ||||
Description | SetTime() sets the time in the terminal's real-time clock to the time in the time structure. | ||||
Syntax | int SetTime( struct time *timep ); | ||||
Arguments |
struct time *timepThe time structure is defined as follows:struct time { unsigned char ti_hour; // hours unsigned char ti_min; // minutes unsigned char ti_sec; // seconds }; |
||||
Returns |
|
||||
Remarks | The time can be read back with the GetTime() function. | ||||
Example |
// SetDate() / SetTime() example #include <stdio.h> #include "lib.h" void main( void ) { struct date d = { .da_day = 3, .da_mon = 11, .da_year = 2028 }; struct time t = { .ti_hour = 8, .ti_min = 9, .ti_sec = 42 }; SetDate( &d ); SetTime( &t ); for(;;) { GetDate( &d ); GetTime( &t ); printf("\n%02d:%02d:%02d", t.ti_hour, t.ti_min, t.ti_sec); printf(" %02d/%02d/%04d", d.da_day, d.da_mon, d.da_year); Delay( 50 ); } } |