Hi,
I can’t find equivalent class of CCTime on cocos2d-x 3.1.1. Please help? Thanks
Hi,
I can’t find equivalent class of CCTime on cocos2d-x 3.1.1. Please help? Thanks
I dont recall that class except that didn’t it do time of day operations?
CCTime was…
int CCTime::gettimeofdayCocos2d(struct cc_timeval *tp, void *tzp)
{
CC_UNUSED_PARAM(tzp);
if (tp)
{
gettimeofday((struct timeval *)tp, 0);
}
return 0;
}
double CCTime::timersubCocos2d(struct cc_timeval *start, struct cc_timeval *end)
{
if (! start || ! end)
{
return 0;
}
return ((end->tv_sec*1000.0+end->tv_usec/1000.0) - (start->tv_sec*1000.0+start->tv_usec/1000.0));
}
you can use gettimeofday()
struct timeval nowTime;
gettimeofday(&nowTime, NULL);
Ah, yes, good idea, std::chrono
and standard time functions should be helpful here
Hi,
Thanks for your reply. honeboy is awesome. You save me.