RAD Studio |  |

time.h
Collapse All

The following functions, macros, and classes are provided in time.h:

Topics

Name | Description
_strdate, _wstrdate | Header File time.h Category Conversion Routines, Time and Date Routines Prototype char *_strdate(char *buf); wchar_t *_wstrdate(wchar_t *buf); Description Converts current date to string. _strdate converts the current date to a string, storing the string in the buffer buf. The buffer must be at least 9 characters long. The string has the form MM/DD/YY where MM, DD, and YY are all two-digit numbers representing the month, day, and year. The string is terminated by a null character. Return Value _strdate returns buf, the address of the date string. Example
_strtime, _wstrtime | Header File time.h Category Time and Date Routines Prototype char *_strtime(char *buf); wchar_t *_wstrtime(wchar_t *buf); Description Converts current time to string. _strtime converts the current time to a string, storing the string in the buffer buf. The buffer must be at least 9 characters long. The string has the following form: HH:MM:SS where HH, MM, and SS are all two-digit numbers representing the hour, minute, and second, respectively. The string is terminated by a null character. Return Value _strtime returns buf, the address of the time string. Example
asctime | Header File time.h Category Time and Date Routines Prototype char *asctime(const struct tm *tblock); wchar_t *_wasctime(const struct tm *tblock); Description asctime converts date and time to ASCII. _wasctime converts date and time to a wchar_t string. asctime and _wasctime convert a time stored as a structure to a 26 (wide) character string in the following form: Mon Nov 21 11:31:54 1983\n\0 All the fields have a constant width. The output string day-of-the-week and month correspond to the following: tm parameterValid value rangeOutput tm.mon (month)0-110=Jan, 1=Feb, and so on tm.day (day-of-the-week)0-60=Sun, 1=Mon, and so on Return Value asctime and _wasctime return... more
clock | Header File time.h Category Time and Date Routines Prototype clock_t clock(void); Description Determines processor time. clock can be used to determine the time interval between two events. To determine the time in seconds, the value returned by clock should be divided by the value of the macro CLK_TCK. Return Value On success, clock returns the processor time elapsed since the beginning of the program invocation. On error (if the processor time is not available or its value cannot be represented), clock returns -1. Example
clock_t | Header File time.h Syntax typedef long clock_t; Description Defines the data type returned by the clock function. Portability
ctime, _wctime | Header File time.h Category Time and Date Routines Prototype char *ctime(const time_t *time); wchar_t *_wctime(const time_t *time); Description Converts date and time to a string. ctime converts a time value pointed to by time (the value returned by the function time) into a 26-character string in the following form, terminating with a newline character and a null character: Mon Nov 21 11:31:54 1983\n\0 All the fields have constant width. The global long variable _timezone contains the difference in seconds between GMT and local standard time (in PST, _timezone is 8*60*60). The global variable _daylight is used to tell the RTL's... more
_daylight | Header File time.h Syntax extern int _daylight; Description _daylight is used by the time and date functions. It is used to tell the RTL's functions (mktime & localtime) whether they should take daylight saving time into account if it runs into a date that would normally fall into that category. _daylight is initialized from the values specified in the TZ environment variable and is set to 1 if the daylight savings time conversion should be applied. If TZ is not set, the value of _daylight is obtained from the operating system.
difftime | Header File time.h Category Time and Date Routines Prototype double difftime(time_t time2, time_t time1); Description Computes the difference between two times. difftime calculates the elapsed time in seconds, from time1 to time2. Return Value difftime returns the result of its calculation as a double. Example
gmtime | Header File time.h Category Time and Date Routines Prototype struct tm *gmtime(const time_t *timer); Description Converts date and time to Greenwich mean time (GMT). gmtime accepts the address of a value returned by time and returns a pointer to the structure of type tm containing the time elements. gmtime converts directly to GMT. The global long variable _timezone should be set to the difference in seconds between GMT and local standard time (in PST _timezone is 8 x 60 x 60). The global variable _daylight should be set to nonzero only if the standard U.S. daylight saving time conversion should... more
localtime | Header File time.h Category Time and Date Routines Prototype struct tm *localtime(const time_t *timer); Description Converts date and time to a structure. localtime accepts the address of a value returned by time and returns a pointer to the structure of type tm containing the time elements. It corrects for the time zone and possible daylight saving time. The global long variable _timezone contains the difference in seconds between GMT and local standard time (in PST, _timezone is 8 x 60 x 60). The global variable _daylight is used to tell the RTL’s functions (mktime & localtime) whether they should take... more
mktime | Header File time.h Category Time and Date Routines Prototype time_t mktime(struct tm *t); Description Converts time to calendar format. Converts the time in the structure pointed to by t into a calendar time with the same format used by the time function. The original values of the fields tm_sec, tm_min, tm_hour, tm_mday, and tm_mon are not restricted to the ranges described in the tm structure. If the fields are not in their proper ranges, they are adjusted. Values for fields tm_wday and tm_yday are computed after the other fields have been adjusted. The tm_isdst (Daylight Savings Time) field is adjusted... more
stime | Header File time.h Category Time and Date Routines Prototype int stime(time_t *tp); Description Sets system date and time. stime sets the system time and date. tp points to the value of the time as measured in seconds from 00:00:00 GMT, January 1, 1970. Return Value stime returns a value of 0. Example
strftime, wcsftime | Header File time.h Category Time and Date Routines Prototype size_t strftime(char *s, size_t maxsize, const char *fmt, const struct tm *t); size_t wcsftime(wchar_t *s, size_t maxsize, const wchar_t *fmt, const struct tm *t); Description Formats time for output. strftime formats the time in the argument t into the array pointed to by the argument s according to the fmt specifications. All ordinary characters are copied unchanged. No more than maxsize characters are placed in s. The time is formatted according to the current locale's LC_TIME category. Return Value On success, strftime returns the number of characters placed into s. On... more
time | Header File time.h Category Time and Date Routines Prototype time_t time(time_t *timer); Description Gets time of day. time gives the current time, in seconds, elapsed since 00:00:00 GMT, January 1, 1970, and stores that value in the location pointed to by timer, provided that timer is not a NULL pointer. Return Value time returns the elapsed time in seconds. Example
_timezone | Header File time.h Syntax extern long _timezone; Description _timezone is used by the time-and-date functions. It is calculated by the tzset function; it is assigned a long value that is the difference, in seconds, between the current local time and Greenwich mean time. On Win32, the value of _timezone is obtained from the operating system.
tm | Header File time.h Syntax struct tm { int tm_sec; /* Seconds */ int tm_min; /* Minutes */ int tm_hour; /* Hour (0--23) */ int tm_mday; /* Day of month (1--31) */ int tm_mon; /* Month (0--11) */ int tm_year; /* Year (calendar year minus 1900) */ int tm_wday; /* Weekday (0--6; Sunday = 0) */ int tm_yday; /* Day of year (0--365) */ int tm_isdst; /* 0 if daylight savings time is not in effect) */ }; Description A structure defining the time, broken down into increments. tm is used by the functions asctime, gmtime, localtime, mktime, and strftime. Example... more
_tzname,_wtzname | Header File time.h Syntax extern char * _tzname[2] extern wchar_t *const _wtzname[2] Description The global variable _tzname is an array of pointers to strings containing abbreviations for time zone names. _tzname[0] points to a three-character string with the value of the time zone name from the TZ environment string. The global variable _tzname[1] points to a three-character string with the value of the daylight saving time zone name from the TZ environment string. If no daylight saving name is present, _tzname[1] points to a null string. On Win32, the value of _tzname is obtained from the operating system.
_tzset, _wtzset | Header File time.h Category Time and Date Routines Prototype void _tzset(void) void _wtzset(void) Description Sets value of global variables _daylight, _timezone, and _tzname. _tzset is available on XENIX systems. _tzset sets the _daylight, _timezone, and _tzname global variables based on the environment variable TZ. _wtzset sets the _daylight, _timezone, and _wtzname global variables. The library functions ftime and localtime use these global variables to adjust Greenwich Mean Time (GMT) to the local time zone. The format of the TZ environment string is: TZ = zzz[+/-]d[d][lll] where zzz is a three-character string representing the name of the current time zone. All... more

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!