mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Check for system time jump back (logging only)
This commit is contained in:
@@ -114,6 +114,7 @@ public class IdeEventQueue extends EventQueue {
|
||||
private boolean myIsInInputEvent;
|
||||
private AWTEvent myCurrentEvent;
|
||||
private long myLastActiveTime;
|
||||
private long myLastEventTime = System.currentTimeMillis();
|
||||
private WindowManagerEx myWindowManager;
|
||||
private final List<EventDispatcher> myDispatchers = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private final List<EventDispatcher> myPostProcessors = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
@@ -338,6 +339,7 @@ public class IdeEventQueue extends EventQueue {
|
||||
|
||||
@Override
|
||||
public void dispatchEvent(@NotNull AWTEvent e) {
|
||||
checkForTimeJump();
|
||||
if (!appIsLoaded()) {
|
||||
try {
|
||||
super.dispatchEvent(e);
|
||||
@@ -382,6 +384,15 @@ public class IdeEventQueue extends EventQueue {
|
||||
}
|
||||
}
|
||||
|
||||
//As we rely on system time monotonicity in many places let's log anomalies at least.
|
||||
private void checkForTimeJump() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (myLastEventTime > now + 1000) {
|
||||
LOG.error("System clock's jumped back by ~" + (myLastEventTime - now) / 1000 + " sec");
|
||||
}
|
||||
myLastEventTime = now;
|
||||
}
|
||||
|
||||
private static boolean isInputEvent(@NotNull AWTEvent e) {
|
||||
return e instanceof InputEvent || e instanceof InputMethodEvent || e instanceof WindowEvent || e instanceof ActionEvent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user