Skip to content

Commit

Permalink
readsbrrd: cast timespec.tv_sec addend to time_t
Browse files Browse the repository at this point in the history
This fixes the following compile error on systems using musl libc:

readsbrrd.c: In function 'main':
readsbrrd.c:581:23: error: '__time_t' undeclared (first use in this function); did you mean 'time_t'?
  581 |         ts.tv_sec += (__time_t) (rrd.step * 1.5);
      |                       ^~~~~~~~
      |                       time_t

Compile-tested on both glibc and musl systems.

Signed-off-by: Stijn Tintel <[email protected]>
  • Loading branch information
stintel committed May 29, 2024
1 parent 305db9b commit f1a986c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readsbrrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ int main(int argc, char** argv) {
// Run this until we get a termination signal.
while (!readsbrrd_exit) {
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += (__time_t) rrd.step * 1.5;
ts.tv_sec += (time_t) rrd.step * 1.5;
r = sem_getvalue(stats_semptr, &semcnt);
// Avoid frequent updates when more than one event is queued in semaphore.
// Update only one very last event.
Expand Down

0 comments on commit f1a986c

Please sign in to comment.