Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use these functions to get the current time and convert, adjust, and store it as necessary. The current time is the system time.
The _ftime and localtime routines use the TZ environment variable. If TZ is not set, the run-time library attempts to use the time-zone information specified by the operating system. If this information is unavailable, these functions use the default value of PST8PDT. For more information on TZ, see _tzset; also see _daylight, timezone, and _tzname.
Time Routines
Function | Use |
asctime, _wasctime | Convert time from type structtm to character string |
clock | Return elapsed CPU time for process |
ctime, _wctime | Convert time from type time_t to character string |
difftime | Compute difference between two times |
_ftime | Store current system time in variable of type struct _timeb |
_futime | Set modification time on open file |
gmtime | Convert time from type time_t to struct tm |
localtime | Convert time from type time_t to struct tm with local correction |
mktime | Convert time to calendar value |
_strdate, _wstrdate | Return current system date as string |
strftime, wcsftime | Format date-and-time string for international use |
_strtime, _wstrtime | Return current system time as string |
time | Get current system time as type time_t |
_tzset | Set external time variables from environment time variable TZ |
_utime, _wutime | Set modification time for specified file using either current time or time value stored in structure |
Note In all versions of Microsoft C/C++ except Microsoft C/C++ version 7.0, and in all versions of Microsoft Visual C++, the time function returns the current time as the number of seconds elapsed since midnight on January 1, 1970. In Microsoft C/C++ version 7.0, time returned the current time as the number of seconds elapsed since midnight on December 31, 1899.