man 3 localtime
NOTES
The four functions acstime(), ctime(), gmtime() and localtime() return a pointer to static data and hence are not thread-safe. Thread-safe versions acstime_r(), ctime_r(), gmtime_r() and localtime_r() are specified by
SUSv2, and available since libc 5.2.5.
The glibc version of struct tm has additional fields
long tm_gmtoff; /* Seconds east of UTC */
const char *tm_tm_zone; /* Timezone abbreviation */
localtime函数及struct tm结构时区信息
博客提到acstime()、ctime()、gmtime()和localtime()四个函数返回静态数据指针,非线程安全,SUSv2指定了线程安全版本。还指出glibc版本的struct tm有额外字段,包含与时区相关的信息。
491





