Collaboration diagram for Time handling Functions:
Use these functions to get the current time and convert, adjust, and store it as necessary. The current time is the system time.
Data Structures | |
struct | _tm |
structure to store a date/time value. More... | |
Typedefs | |
typedef _tm | tm |
Type definition for struct _tm. | |
typedef long | time_t |
Serial date/time. Holds number of seconds after January 1st, 1970. | |
Functions | |
time_t | time (time_t *timer) |
Get the system time. | |
int | gmtime_r (CONST time_t *timer, tm *theTime) |
Convert a time value to a structure. | |
tm * | gmtime (CONST time_t *timer) |
Convert a time value to a structure. | |
int | localtime_r (CONST time_t *timer, tm *theTime) |
Convert a time value and correct for the local time zone. | |
tm * | localtime (CONST time_t *timer) |
Convert a time value and correct for the local time zone. | |
int | stime (time_t *timer) |
Set the system time. | |
time_t | mktime (tm *timeptr) |
Convert the local time to a calendar value. | |
time_t | _mkgmtime (tm *timeptr) |
Variables | |
u_char | _daylight |
Used to control daylight conversions. | |
long | _timezone |
Defines your local timezone. | |
long | _dstbias |
Difference between standard and daylight savings time in seconds. |
|
Get the system time. The time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC), according to the system clock. The return value is stored in the location given by timer. This parameter may be NULL, in which case the return value is not stored.
|
|
Convert a time value to a structure. Thread safe version of gmtime. See gmtime for more information.
|
|
Convert a time value to a structure. The gmtime function breaks down the timer value and stores it in a statically allocated structure of type tm, defined in time.h. The value of timer is usually obtained from a call to the time function.
|
|
Convert a time value and correct for the local time zone. Thread safe version of localtime. See localtime for more information.
|
|
Convert a time value and correct for the local time zone. The localtime function converts a time stored as a time_t value and stores the result in a structure of type tm. The long value timer represents the seconds elapsed since midnight (00:00:00), January 1, 1970, UTC. This value is usually obtained from the time function. gmtime, mktime, and localtime all use a single statically allocated tm structure for the conversion. Each call to one of these routines destroys the result of the previous call. localtime corrects for the local time zone if the user first sets the global variable _timezone.
|
|
Set the system time.
|
|
Convert the local time to a calendar value.
The mktime function converts the supplied time structure (possibly incomplete) pointed to by timeptr into a fully defined structure with normalized values and then converts it to a time_t calendar time value. The converted time has the same encoding as the values returned by the time function. The original values of the After an adjustment to Greenwich Mean Time (GMT), mktime handles dates from midnight, January 1, 1970, to January 19, 3:14:07, 2038. This adjustment may cause mktime to return -1 (cast to time_t) even though the date you specify is within range. For example, if you are in Cairo, Egypt, which is two hours ahead of GMT, two hours will first be subtracted from the date you specify in timeptr; this may now put your date out of range.
If successful, mktime sets the values of
|
|
Used to control daylight conversions. Assign a nonzero value to enable daylight conversions. If enabled the hour part of time values is adjusted if we are in daylight saving time. Zero value to disable conversion. Default is enabled. |
|
Defines your local timezone. Difference in seconds between universal coordinated time and local time. This value is subtracted from the universal coordinated time to calculate your local time. Default value is 5 * 60 * 60 = 18000, which defines the time zone EST (GMT-5).
|
|
Difference between standard and daylight savings time in seconds. This value is used to calculate the daylight savings time by subtracting this value from the standard time. Unit is seconds. Usually daylight savings time is one hour in advance to standard time, thus the default value is -1 * 60 * 60 = -3600. |