error: '

    技术2022-05-20  37

    '_localtime_not_threadsafe_' was not declared in this scope

     

    多线程安全问题,不能直接用localtime,而要用localtime_r函数

     

    1080     time_t timer;

    1081     time(&timer);

    1082 

    1083     struct tm *t_tm;

    1084     char tmpbuf[8];

    1085     //t_tm = localtime_r(&timer,t_tm);

    1086     localtime_r(&timer,t_tm);

    1087     //strftime(tmpbuf,128,"%F %X", newtime);

    1088     sprintf(tmpbuf,"Mdd", t_tm->tm_year, t_tm->tm_mon, t_tm->tm_mday);


    最新回复(0)