The timing code in pulse is slightly twiddly and will probably be the
same for all output implementations.
static struct tm displayed;
+static void
+dummy_out(bool state)
+{
+
+ /* Dummy implementation */
+ if (state) {
+ printf("ker...");
+ fflush(stdout);
+ } else {
+ printf("chunk!\n");
+ fflush(stdout);
+ }
+}
+
static void
pulse()
{
struct timespec const ts = { 0, pulsewidth };
- /* Dummy implementation */
- printf("ker...");
- fflush(stdout);
+
+ dummy_out(true);
clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
- printf("chunk!");
+ dummy_out(false);
displayed.tm_sec += 30;
while (displayed.tm_sec >= 60) {
displayed.tm_min++;