break;
}
}
+ /* Default startup state is to assume the dial is correct. */
+ if (clock_gettime(CLOCK_REALTIME, &ts) != 0)
+ err(1, "clock_gettime");
+ if (localtime_r(&ts.tv_sec, &displayed) == NULL)
+ err(1, "localtime_r");
+ displayed.tm_sec = (displayed.tm_sec >= 30) ? 30 : 0;
if (statefile != NULL)
init_statefile(statefile);
/* Allow -s to override state read from file. */
if (statestr != NULL)
init_statestring(statestr);
- if (statefile == NULL && statestr == NULL) {
- if (clock_gettime(CLOCK_REALTIME, &ts) != 0)
- err(1, "clock_gettime");
- if (localtime_r(&ts.tv_sec, &displayed) == NULL)
- err(1, "localtime_r");
- displayed.tm_sec = (displayed.tm_sec >= 30) ? 30 : 0;
- }
#ifdef WITH_LIBGPIOD
if (gpiod_line_name != NULL || gpiod_chip != NULL)
init_libgpiod(gpiod_chip, gpiod_line_name, gpiod_line_num);