和正确时间差了一个多小时。
struct timeval nowTimeval;
gettimeofday(&nowTimeval, NULL);
struct tm* tm;
time_t time_sec;
time_sec = nowTimeval.tv_sec;
tm = localtime(&time_sec);
CCLOG("%d%%d%d",tm->tm_hour,tm->tm_min,tm->tm_sec);
struct timeval nowTimeval;
gettimeofday(&nowTimeval, NULL);
struct tm* tm;
time_t time_sec;
time_sec = nowTimeval.tv_sec;
tm = localtime(&time_sec);
CCLOG("%d%%d%d",tm->tm_hour,tm->tm_min,tm->tm_sec);