History

merge new work into andrew/inertia

Andrew Meadows committed 12 years ago

Commit a7c4b022 parents 39252a8 b05a31554 files · +938 −883Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 54 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+3−3
@@ -294,8 +294,8 @@ void ScriptEngine::run() { · 293 unmodified lines
294294 emit errorMessage("Uncaught exception at line" + QString::number(line) + ":" + result.toString());
295295 }
296296
297− timeval startTime;
298− gettimeofday(&startTime, NULL);
297+ QElapsedTimer startTime;
298+ startTime.start();
299299
300300 int thisFrame = 0;
301301
@@ -304,7 +304,7 @@ void ScriptEngine::run() { · 2 unmodified lines
304304 qint64 lastUpdate = usecTimestampNow();
305305
306306 while (!_isFinished) {
307− int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - usecTimestampNow();
307+ int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec
308308 if (usecToSleep > 0) {
309309 usleep(usecToSleep);
310310 }