cocos2d-x 3.x后原本CCTime被弃用,所以,只能使用C库中的函数获取系统日期和时间
time_t time_now;
time(&time_now);
struct tm* t = localtime(&time_now);
int nHour = t->tm_hour;
int nMinute = t->tm_min;
int nSecond = t->tm_sec;
log("hh:%d", nHour);
log("mm:%d", nMinute);
log("ss:%d", nSecond);
以上代码是可以跨平台的,有1s内的误差。