Cocos2dx:获取系统毫秒时间
发布时间:2020-12-14 16:21:38 所属栏目:百科 来源:网络整理
导读:在CCTime中,存在接口gettimeofdayCocos2d: class CC_DLL CCTime{public: static int gettimeofdayCocos2d(struct cc_timeval *tp,void *tzp); static double timersubCocos2d(struct cc_timeval *start,struct cc_timeval *end);}; 我们调用接口获取时间,
在CCTime中,存在接口gettimeofdayCocos2d: class CC_DLL CCTime { public: static int gettimeofdayCocos2d(struct cc_timeval *tp,void *tzp); static double timersubCocos2d(struct cc_timeval *start,struct cc_timeval *end); }; 我们调用接口获取时间,但是这个时间只有秒和微妙,就需要我们自己进行装换了: int getCurrentTime() { struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now,NULL); return now.tv_sec * 1000 + now.tv_usec / 1000; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |