<ctime>(time.h)
Concepts:
Coordinated Universal Time(UTC):协调世界时,又称为世界标准时间,也就是大家所熟知的格林威治标准时间(Greenwich Mean Time,GMT)。比如,中国内地的时间与UTC的时差为+8,也就是UTC+8。美国是UTC-5。
Calendar Time:日历时间,是用“从一个标准时间点到此时的时间经过的秒数”来表示的时间。这个标准时间点对不同的编译器来说会有所不同,但对一个编译系统来说,这个标准时间点是不变的,该编译系统中的时间对应的日历时间都通过该标准时间点来衡量,所以可以说日历时间是“相对时间”,但是无论你在哪一个时区,在同一时刻对同一个标准时间点来说,日历时间都是一样的。(简单点说,可以理解为CT时间就是UTC时间减去1900-01-01 00:00:00)
C Time Library
This header file contains definitions of functions to get and manipulate date and time information.
Functions
Time manipulation
-
clock
- Clock program (function )
-
difftime
- Return difference between two times (function )
-
mktime
- Convert tm structure to time_t (function )
-
time
- Get current time (function )
Conversion
-
asctime
- Convert tm structure to string (function )
-
ctime
- Convert time_t value to string (function )
-
gmtime
- Convert time_t to tm as UTC time (function )
-
localtime
- Convert time_t to tm as local time (function )
-
strftime
- Format time as string (function )
Macro constants
-
CLOCKS_PER_SEC
- Clock ticks per second (macro )
-
NULL
- Null pointer (macro )
types
-
clock_t
- Clock type (type )
-
size_t
- Unsigned integral type (type )
-
time_t
- Time type (type )
-
struct tm
- Time structure (type )