#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为消除编译器给出的警告。因为该函数第二个参数没用到,可能是为了扩展用的吧。

相关文章:

  • 2022-02-14
  • 2022-01-17
  • 2021-10-20
  • 2022-03-02
  • 2021-06-06
  • 2022-01-23
  • 2022-01-14
  • 2022-02-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
相关资源
相似解决方案