IOS7: Fix implementation of getMillis()

The documentation indicates that it should return the number of
milliseconds since the application started. It was however using
a different reference (last boot of the device minus the sleep time)
resulting in a much bigger value than expected.
This commit is contained in:
Thierry Crozat 2020-02-01 22:53:20 +00:00
parent 2d54e3e87f
commit 98b7095527
2 changed files with 3 additions and 3 deletions

View File

@ -158,7 +158,7 @@ void OSystem_iOS7::initBackend() {
_timerManager = new DefaultTimerManager();
gettimeofday(&_startTime, NULL);
_startTime = CACurrentMediaTime();
setupMixer();
@ -242,7 +242,7 @@ void OSystem_iOS7::suspendLoop() {
uint32 OSystem_iOS7::getMillis(bool skipRecord) {
CFTimeInterval timeInSeconds = CACurrentMediaTime();
return (uint32) (timeInSeconds * 1000.0);
return (uint32) ((timeInSeconds - _startTime) * 1000.0) - _timeSuspended;
}
void OSystem_iOS7::delayMillis(uint msecs) {

View File

@ -74,7 +74,7 @@ protected:
// For use with the mouse texture
uint16 _gamePaletteRGBA5551[256];
struct timeval _startTime;
CFTimeInterval _startTime;
uint32 _timeSuspended;
bool _mouseCursorPaletteEnabled;