[android&ios] Stopwatch cocos2d-x

I’m currently facing a problem.

I create a games where user can race within a level, and there’s stopwatch to count the time user finished the level.

I use this code snippet for convert the counter to stopwatch

@
m_timer++;
int milliseconds = m_timer%60;
int seconds = (m_timer/60)60;
int minutes = m_timer/3600;

CCString * P1Time = CCString::createWithFormat(“02d:02d:02d”, minutes,seconds,milliseconds);

m_label->setString(P1Time->getCString());
@

I called this function in my update method…

The problem is in every device (iOS and Android) the stopwatch produce various result…

In my test case, if user doesn’t make any input, he should be lost in about 32 secs….

iOS (iPhone 4) is the closest one, with stopwatch ~32 secs

But in Android device, The result is vary…

Google Nexus S 28 seccs

new Google Nexus 7 18 secs

Galaxy Note 30 secs

It’s important that stopwatch must be sync in every device, because i have a leaderboard based on user’s stopwatch result.

How do I supposed to do this?

Use delta time provided by Cocos2dx via either CCDirector::getDeltaTime or CCNode::update(float dt).