typedef int time_t;
Store calendar time type
typedef int clock_t;
The type to store the processor time, needs to be divided by CLOCKS_PER_SEC to get the actual number of seconds
struct { ... } tm;
Structure to hold time and date
char* asctime(struct tm *timeptr);
Returns a pointer to a string representing the date and time of the structure struct timeptr
time_t clock();
Returns the time used by the processor clock, divided by CLOCKS_PER_SEC
char* ctime(time_t *timer);
Returns a string representing the local time based on the parameter timer
double difftime(time_t endTime, time_t fromTime);
return the endTime - fromTime in seconds
struct tm* gmtime(time_t *timer);
Populate the tm structure with the value of timer , expressed in Coordinated Universal Time (UTC) also known as Greenwich Mean Time (GMT)
struct tm* localtime(time_t *timer);
Fill the tm structure with the value of timer. The value of timer is decomposed into a tm structure and expressed in the local time zone
time_t mktime(struct tm *timePtr);
Transfer tm to time_t
time_t time(time_t *timer);
Get current calendar time or set calendar time
int strftime(char *string, size_t maxSize, char *format, struct tm *timePtr);
Formats the time represented by the structure timeptr according to the formatting rules defined in format and stores it in str.
char* strptime(char *string, char *format, struct tm *timePtr);
Convert a string to a time type according to a specific time format
struct tm* gmtime_r(time_t *timePtr, struct tm *result);
Same to gmtime (Thread Safe)
int timegm(struct tm *timePtr);
Transfer tm to time_t
int CLOCKS_PER_SEC;
Theoretically refers to the number of clocks in one second of the CPU, which is now used in the clock function to calculate the real number of seconds
typedef int time_t;
存储日历时间类型
typedef int clock_t;
存储处理器时间的类型,需要除CLOCKS_PER_SEC获得实际秒数
struct { ... } tm;
用来保存时间和日期的结构
char* asctime(struct tm *timeptr);
返回一个指向字符串的指针,它代表了结构 struct timeptr 的日期和时间
time_t clock();
返回处理器时钟所使用的时间,需要除以 CLOCKS_PER_SEC
char* ctime(time_t *timer);
返回一个表示当地时间的字符串,当地时间是基于参数 timer
double difftime(time_t endTime, time_t fromTime);
计算两个时间的差值
struct tm* gmtime(time_t *timer);
使用 timer 的值来填充 tm 结构,并用协调世界时(UTC)也被称为格林尼治标准时间(GMT)表示
struct tm* localtime(time_t *timer);
使用 timer 的值来填充 tm 结构。timer 的值被分解为 tm 结构,并用本地时区表示
time_t mktime(struct tm *timePtr);
将tm转换为time_t
time_t time(time_t *timer);
得到当前日历时间或者设置日历时间
int strftime(char *string, size_t maxSize, char *format, struct tm *timePtr);
根据 format 中定义的格式化规则,格式化结构 timeptr 表示的时间,并把它存储在 str 中
char* strptime(char *string, char *format, struct tm *timePtr);
按照特定时间格式将字符串转换为时间类型
struct tm* gmtime_r(time_t *timePtr, struct tm *result);
等同于 gmtime (Thread Safe)
int timegm(struct tm *timePtr);
从tm转换为time_t
int CLOCKS_PER_SEC;
理论上指的CPU一秒内时钟数,现用于clock函数计算真实秒数