cocos2dx 获取系统时间

来源:互联网 发布:ghost软件的使用方法 编辑:程序博客网 时间:2024/06/05 01:55

很简单的方法:

long Player::getCurrentTime(){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);   long timeSecond = tm->tm_sec + tm->tm_min * 60 + tm->tm_hour * 3600; return timeSecond;}


0 0