您的位置:首页 > Web前端

error: '_localtime_not_threadsafe_' was not declared in this scope

2011-02-24 17:46 549 查看
'_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,"%4d%02d%02d", t_tm->tm_year, t_tm->tm_mon, t_tm->tm_mday);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: