Add logs to detect negative changes in system clock.

This commit is contained in:
Greyson Parrelli
2022-08-10 14:38:05 -04:00
committed by Alex Hart
parent 3cb674f095
commit f8220ca554
2 changed files with 19 additions and 0 deletions

View File

@@ -231,6 +231,16 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
KeyCachingService.onAppForegrounded(this);
ApplicationDependencies.getShakeToReport().enable();
checkBuildExpiration();
long lastForegroundTime = SignalStore.misc().getLastForegroundTime();
long currentTime = System.currentTimeMillis();
long timeDiff = currentTime - lastForegroundTime;
if (timeDiff < 0) {
Log.w(TAG, "Time travel! The system clock has moved backwards. (currentTime: " + currentTime + " ms, lastForegroundTime: " + lastForegroundTime + " ms, diff: " + timeDiff + " ms)");
}
SignalStore.misc().setLastForegroundTime(currentTime);
});
Log.d(TAG, "onStart() took " + (System.currentTimeMillis() - startTime) + " ms");