CCTime delta value inconsistent - issue with Cocos2D-X

CCTime delta value inconsistent - issue with Cocos2D-X
0.0 0


CCTime delta times seem to be very inconsistent.

If you download the latest Cocos2d-X and open the HelloCpp sample app, add a “scheduleUpdate();” to the end of the “bool HelloWorld::init()” function, add the following function for the update call:

void HelloWorld::update( float dt )
    CCLOG( "delta: %f\n",dt );

When it is running, you will see the log output like this:-

delta: 0.017457
delta: 0.015649
delta: 0.016756
delta: 0.016518
delta: 0.016742
delta: 0.016803
delta: 0.018461
delta: 0.015265
delta: 0.016842
delta: 0.016505
delta: 0.017283

In an app that isn’t really doing anything should give values very near 0.01666r (60fps or 1/60=1.666r). Values of 0.0172, 0.0156 and 0.0184 are very far out for an app that isn’t really doing anything. If you are animating a sprites movement with the delta value “pos.x = pos.x+(movement * delta);” then the movement is visibly jerky.

I’ve tested this on an iPhone 4 and in Android on a Samsung GS3, same result. Is there something wrong with Cocos2D-X’s engine?

Note: I posted about this 11 months ago but it is still going on (here:


I have the exact same issue but in my case, the delta time can jump upto 0.05 a few times while 0.02 is quite common.

Please let me know how to fix it.


P.S I am using float dt instead of ccTime (since it is not supported).


Walzer Wang could you please help? Would really appreciate it. Thanks