History

merge upstream/master into andrew/inertia

Andrew Meadows committed 12 years ago

Commit b05a3152 parents f91c098 b0a561154 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
@@ -292,8 +292,8 @@ void ScriptEngine::run() { · 291 unmodified lines
292292 emit errorMessage("Uncaught exception at line" + QString::number(line) + ":" + result.toString());
293293 }
294294
295− timeval startTime;
296− gettimeofday(&startTime, NULL);
295+ QElapsedTimer startTime;
296+ startTime.start();
297297
298298 int thisFrame = 0;
299299
@@ -302,7 +302,7 @@ void ScriptEngine::run() { · 2 unmodified lines
302302 qint64 lastUpdate = usecTimestampNow();
303303
304304 while (!_isFinished) {
305− int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - usecTimestampNow();
305+ int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec
306306 if (usecToSleep > 0) {
307307 usleep(usecToSleep);
308308 }