qq_蜗牛_67
2016-06-01 14:41
struct timeval nowTimeval;
gettimeofday(&nowTimeval,NULL);
struct tm *tm;
time_t time_sec;
time_sec = nowTimeval.tv_sec;
tm = localtime(&time_sec);
CCLOG("hour = %d ,minitue = %d, second = %d",tm->tm_hour,tm->tm_min,tm->tm_sec);
win32 平台,获取时间 struct tm *tm; time_t timep; #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) time(&timep); #else struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now, NULL); timep = now.tv_sec; #endif tm = localtime(&timep); int year = tm->tm_year + 1900; int month = tm->tm_mon + 1; int day = tm->tm_mday; int hour = tm->tm_hour; int min = tm->tm_min; int second = tm->tm_sec;
Cocos2d-x基础教程二-会动的时钟
19036 学习 · 44 问题
相似问题