gmtime()/localtime() are not thread-safe

man 3 localtime

       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 */

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页