RAD Studio
ContentsIndex
PreviousUpNext
gettime, settime

Header File 

dos.h  

Category 

Time and Date Routines 

Prototype 

void gettime(struct time *timep); 

void settime(struct time *timep); 

Description 

Gets and sets the system time. 

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 */ 

}; 

Return Value 

None. 

Example  

#include   <stdio.h>
#include   <dos.h>
int main(void)
{
   struct  time t;
   gettime(&t);
   printf("The current time is: %2d:%02d:%02d.%02d\n",
          t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);
   return 0;
}
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!