I'm writing a native android app which calculates the time elapsed in milliseconds using std::clock(). The sample code to calculate elapsed time is below:
elapsedTime = ((float)(std::clock() - startTime)/CLOCKS_PER_SEC) * 1000;
However, it doesn't seem to match the regular clock (laptop's clock or regular watch) at all. For example, elapsedTime of 30 seconds comes out to be equal to 20 seconds of the regular watch. This works fine on previous versions of android (4.0 etc.) though. Any hints on why it's behaving differently on different versions of Android OS.