gettime, settime
raw OCR
Gets and sets the system time.
Defined in header <dos.h>
Syntax
#include <dos.h>
void gettime(struct time *timep);
void settime(struct time *timep);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
gettime fills in the time structure pointed to by timep with the system's current time.
settime sets the system time to the values in the time structure pointed to by timep.
The time structure is defined as follows:
struct time {
| unsigned char ti_min; | /* minutes */ |
| unsigned char ti_hour; | /* hours */ |
| unsigned char ti_hund; | /* hundredths of seconds */ |
| unsigned char ti_sec; }; | /* seconds */ |
Retum value
None.
See also
Example
#include <stdio.h>
#include <dos.h>
int main(void)
{
struct time t;
gettime(&t);
printfC'The current minute is: %d\n", t.ti_min);
printfC'The current hour is: %d\n", t.ti_hour);
printfC'The current hundredth of a second is: ld\n", t.ti_hund);
printfC'The current second is: %d\n", t.ti_sec);
/* add 1 to minutes struct element, then call settime */
t.ti_min++;
settime(&t);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `gettime., settime` read as `gettime, settime`
Stable link: /3.1/dos.h/gettime/
· short form /3.1/gettime/