hi man

博客园 首页 新随笔 联系 订阅 管理

#include <time.> 

struct cocos2d::cc_timeval now;  // 秒,毫秒

cocos2d::CCTime::gettimeofdayCocos2d(&now, NULL);

struct tm * tm;

tm = localtime(&now.tv_sec);

int year = tm->tm_year + 1900;

int month = tm->tm_mon + 1;

int day = tm->tm_mday;

 

注意:在CCTime::gettimeofdayCocos2d函数中CC_UNUSED_PARAM为消除编译器给出的警告。因为该函数第二个参数没用到,可能是为了扩展用的吧。

posted on 2012-11-25 19:14  KuPig  阅读(5104)  评论(1编辑  收藏  举报