很简单的方法:
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; }