From: Ben Harris Date: Fri, 23 Nov 2018 19:33:21 +0000 (+0000) Subject: Don't depend on the field order of struct timespec. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=2e6a1c0f903a75c5db397fb158d8d9dd93f3fcf9;p=clunk.git Don't depend on the field order of struct timespec. POSIX merely requires that tv_sec and tv_nsec be present, so initialisers need to name them explicitly. --- diff --git a/clunk.c b/clunk.c index db8e06c..73a4eef 100644 --- a/clunk.c +++ b/clunk.c @@ -126,7 +126,7 @@ record_tick_finished(void) static void pulse() { - struct timespec const ts = { 0, pulsewidth }; + struct timespec const ts = { .tv_sec = 0, .tv_nsec = pulsewidth }; sigset_t saved_mask; if (sigprocmask(SIG_BLOCK, &signals_to_block, &saved_mask) != 0)