Speculative fix from a crash report from the wild

This commit is contained in:
Aaron Culliney 2016-05-05 21:06:52 -07:00
parent ab59b089d9
commit aad2f0a71e

View File

@ -441,9 +441,13 @@ static void *cpu_thread(void *dummyptr) {
if (!is_fullspeed) {
deltat = timespec_diff(ti, tj, &negative);
assert(!negative);
if (negative) {
// 2016/05/05 : crash report from the wild on Android if we assert(!negative)
LOG("WHOA... time went backwards! Did you just cross a timezone?");
deltat.tv_sec = 1;
}
long sleepfor = 0;
if (!deltat.tv_sec)
if (LIKELY(!deltat.tv_sec))
{
sleepfor = EXECUTION_PERIOD_NSECS - drift_adj_nsecs - deltat.tv_nsec;
}