前端之家收集整理的这篇文章主要介绍了
cocos2d-x 获取日期,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
struct timeval now;
struct tm* time;
gettimeofday(&now,NULL);
time = localtime(&now.tv_sec);
char date[32] = {0};
sprintf(date,"%d%02d%02d",(int)time->tm_year + 1900,(int)time->tm_mon + 1,(int)time->tm_mday);
CCLog("%s",date);
系统毫秒数:
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="white-space:pre"> </span> struct cc_timeval tv;</span>
<pre name="code" class="cpp"> CCTime::gettimeofdayCocos2d(&tv,NULL);
cout<<tv.tv_sec * 1000 + tv.tv_usec / 1000 <<endl;