static long const pulsewidth = 250000000; /* nanoseconds */
+/*
+ * Maximum error to correct by advancing the clock rather than
+ * stopping it, in seconds. The point where it's faster to stop the
+ * clock than to advance it is around 11:15 forwards (0:45 backwards),
+ * but this is set a little lower so that setting the clock back for
+ * the end of summer time is done by stopping, in accordance with
+ * Synchronome's documentation.
+ */
+static int const maxadvance = (10 * 3600) + (50 * 60);
+
static struct tm displayed;
static void
if (diff < 0) diff += 3600 * 12;
diff %= 3600 * 12;
printf("diff = %ld\n", diff);
- if (diff < 30 || diff >= (10 * 3600)) return STOP;
+ if (diff < 30 || diff >= maxadvance) return STOP;
if (diff < 60) return TICK;
if (diff < (10 * 3600)) return ADVANCE;
}