1.时间相关:
数据类型time_t 称为calendar time. When interpreted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
数据类型tm 称为Broken-down time is stored in the structure tm which is defined in as follows:
struct tm {
int tm_sec; /* seconds */
int tm_min; /* minutes */
int tm_hour; /* hours */
int tm_mday; /* day of the month */
int tm_mon; /* month */
int tm_year; /* year */
int tm_wday; /* day of the week */
int tm_yday; /* day in the year */
int tm_isdst; /* daylight saving time */
};
特别注意:tm_mon和tm_year,月0~11,年指的是从1990年开始的年数。
//关于localtime_r
struct tm *localtime_r(const time_t *timeval, struct tm *result);
Threadsafe: Yes,
Description
This function is the restartable version of localtime(). It is the same as localtime() except that it passes in the place to store the returned structure result.
Return Value
The localtime_r() returns a pointer to the structure result. There is no error return value.
//关于localtime
struct tm * localtime ( const time_t * timer );
***Convert time_t to tm as local time
Uses the time pointed by timer to fill a tm structure with the values that represent the corresponding local time.
2.关于无符号长整型:
unsigned long long 对应printf 格式 %llu,
long long int 对应格式为 %lld
用long long时,注意加后缀ll
unsigned long long x = 0xffffffffffffffffll;
%p 以16进制的形式输出地址(线性地址) -比%X输出时多0X,有时候用来打印线程号还是比较方便。
阅读(705) | 评论(1) | 转发(0) |