+/* An unfortunate situation is this: the saver is not active, because the
+ user has been typing. The machine is a laptop. The user closes the lid
+ and suspends it. The CPU halts. Some hours later, the user opens the
+ lid. At this point, Xt's timers will fire, and xscreensaver will blank
+ the screen.
+
+ So far so good -- well, not really, but it's the best that we can do,
+ since the OS doesn't send us a signal *before* shutdown -- but if the
+ user had delayed locking (lockTimeout > 0) then we should start off
+ in the locked state, rather than only locking N minutes from when the
+ lid was opened. Also, eschewing fading is probably a good idea, to
+ clamp down as soon as possible.
+
+ We only do this when we'd be polling the mouse position anyway.
+ This amounts to an assumption that machines with APM support also
+ have /proc/interrupts.
+ */
+static void
+check_for_clock_skew (saver_info *si)
+{
+ saver_preferences *p = &si->prefs;
+ time_t now = time ((time_t *) 0);
+ long shift = now - si->last_wall_clock_time;
+
+#ifdef DEBUG_TIMERS
+ if (p->verbose_p)
+ fprintf (stderr, "%s: checking wall clock (%d).\n", blurb(),
+ (si->last_wall_clock_time == 0 ? 0 : shift));
+#endif /* DEBUG_TIMERS */
+
+ if (si->last_wall_clock_time != 0 &&
+ shift > (p->timeout / 1000))
+ {
+ if (p->verbose_p)
+ fprintf (stderr, "%s: wall clock has jumped by %d:%02d:%02d!\n",
+ blurb(),
+ (shift / (60 * 60)), ((shift / 60) % 60), (shift % 60));
+
+ si->emergency_lock_p = True;
+ idle_timer ((XtPointer) si, 0);
+ }
+
+ si->last_wall_clock_time = now;
+}
+
+
+