From: Ben Harris Date: Sat, 24 Nov 2018 09:39:56 +0000 (+0000) Subject: Adjust pulsewidth and gapwidth. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=1dba814f1ffe271f1e18bbf7d4c08ad037516012;p=clunk.git Adjust pulsewidth and gapwidth. Since pulsewidth is the length of the sleep in pulse(), it's guaranteed that the actual pulse will be longer than this, so we can safely set it to the minimum allowed, for minimum power consumption. On the other hand, gapwidth should be raised slightly since a real Clock No. 36 could would leave at least 500 ms between pulses (in "advance" mode with a 500 ms pulse width). --- diff --git a/clunk.c b/clunk.c index 4cb8a70..9e18542 100644 --- a/clunk.c +++ b/clunk.c @@ -15,12 +15,14 @@ * * */ -static long const pulsewidth = 250000000; /* nanoseconds */ +static long const pulsewidth = 200000000; /* nanoseconds */ /* - * Minimum gap between pulses. + * Minimum gap between pulses. The fastest a Clock No. 36 could emit + * pulses was once per second, so with a maximum pulse width of + * 500 ms, that leaves 500 ms between pulses. */ -static long const gapwidth = 250000000; /* nanoseconds */ +static long const gapwidth = 500000000; /* nanoseconds */ /* * Maximum error to correct by advancing the clock rather than @@ -92,7 +94,7 @@ record_tick(void) * The straightforward thing to do here would simply * be to pwrite() to the state file. However, we * don't do that because we'd like to drop the clock - * GPIO line in 250 ms, and the write might take + * GPIO line in 200 ms, and the write might take * longer than that (especially since statefd is * opened with O_DSYNC). So it's time to plunge into * POSIX aio. Happily, it's pleasant enough in a