Export (0) Print
Expand All
3 out of 4 rated this helpful - Rate this topic

Time Management

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 struct tm to character string
clock Return elapsed CPU time for process
ctime, _ctime64, _wctime, _wctime64 Convert time from type time_t or __time64_t to character string
difftime Compute difference between two times
_ftime, _ftime64 Store current system time in variable of type struct _timeb or type struct __timeb64
_futime, _futime64 Set modification time on open file
gmtime, _gmtime64 Convert time from type time_t to struct tm or from type __time64_t to struct tm
localtime, _localtime64 Convert time from type time_t to struct tm or from type __time64_t to struct tm with local correction
mktime, _mktime64 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, _time64 Get current system time as type time_t or as type __time64_t
_tzset Set external time variables from environment time variable TZ
_utime, _utime64, _wutime, _wutime64 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.

See Also

Run-Time Routines by Category | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.