访问我的个人博客 秋码个人博客
以备往后需要,就做个记录。
struct tm *tm;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
struct cc_timeval now;
CCTime::gettimeofdayCocos2d(&now, NULL);
tm = localtime(&now.tv_sec);
#endif
#if ( CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 )
time_t timep;
time(&timep);
tm = localtime(&timep);
#endif
int day = tm->tm_mday;
int hour = tm->tm_hour;