chiark / gitweb /
Don't depend on the field order of struct timespec.
authorBen Harris <bjh21@bjh21.me.uk>
Fri, 23 Nov 2018 19:33:21 +0000 (19:33 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sat, 8 Dec 2018 22:30:09 +0000 (22:30 +0000)
POSIX merely requires that tv_sec and tv_nsec be present, so
initialisers need to name them explicitly.

clunk.c

diff --git a/clunk.c b/clunk.c
index db8e06cc3fa40e9be39f129245fdfc7b62059a4f..73a4eef6fcc5b62b4f6ee70d636b01dc1183747b 100644 (file)
--- 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)