Time.h
Encyclopedia
C date and time functions refer to a group of functions in the standard library
of the C programming language
implementing date and time manipulation operations. They provide support for time acquisition, conversion between date formats and formatted output to strings.
(
).
Time manipulation
Format conversions
Constants
Types
C standard library
The C Standard Library is the standard library for the programming language C, as specified in the ANSI C standard.. It was developed at the same time as the C POSIX library, which is basically a superset of it...
of the C programming language
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
implementing date and time manipulation operations. They provide support for time acquisition, conversion between date formats and formatted output to strings.
Function overview
The C date and time operations are defined in thetime.h
header fileHeader file
Some programming languages use header files. These files allow programmers to separate certain elements of a program's source code into reusable files. Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers...
(
ctime
header in C++C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
).
Time manipulation
difftime
- computes the difference between timestime
- returns the current time of the system as time since epochclock
- returns raw processor clock time since the program is started
Format conversions
asctime
- converts atm
object to a textual representationctime
- converts atm
object to a textual representationstrftime
- converts atm
object to custom textual representationwcsftime
- converts atm
object to custom wide string textual representationgmtime
- converts time since epoch to calendar time expressed as Universal Coordinated Timelocaltime
- converts time since epoch to calendar time expressed as local timemktime
- converts calendar time to time since epoch
Constants
CLOCKS_PER_SEC
- number of processor clock ticks per second
Types