[client] we are getting the clock anyway, just reset the time

This commit is contained in:
Geoffrey McRae 2020-08-09 15:54:45 +10:00
parent 302b988524
commit fb9b772db0
2 changed files with 3 additions and 13 deletions

View file

@ -1 +1 @@
B2-rc2-28-g19c2fe9b5e+1
B2-rc2-29-g302b988524+1

View file

@ -159,22 +159,12 @@ static int renderThread(void * unused)
{
if (state.frameTime > 0)
{
tsAdd(&time, state.frameTime);
// if our clock is too far out of sync, resync it
// this can happen when switching to/from a TTY, or due to clock drift
// we only check this once every 100 frames
if (++resyncCheck == 100)
{
resyncCheck = 0;
struct timespec end, diff;
clock_gettime(CLOCK_REALTIME, &end);
tsDiff(&diff, &time, &end);
if (diff.tv_sec > 0 || diff.tv_nsec > 1000000000 || // 100ms
diff.tv_sec < 0 || diff.tv_nsec < 0) // underflow
clock_gettime(CLOCK_REALTIME, &time);
clock_gettime(CLOCK_REALTIME, &time);
}
tsAdd(&time, state.frameTime);
}
if (state.lgrResize)