Skip to content

Commit

Permalink
clockdiff: Fix print time_t problem on 32 bits musl
Browse files Browse the repository at this point in the history
Similarly to 0fd2db7 this fixes warning on 32 bit musl 1.2.0, which
changed time_t as 64-bit across all archs [1]. This fixes warning:

../clockdiff.c:626:35: warning: format '%ld' expects argument of type
'long int', but argument 2 has type 'time_t' {aka 'long long int'}
[-Wformat=]
  626 |  printf("%ld %d %d\n", now, ctl.measure_delta, ctl.measure_delta1);
      |          ~~^           ~~~
      |            |           |
      |            long int    time_t {aka long long int}
      |          %lld

[1] https://musl.libc.org/time64.html

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Jun 5, 2024
1 parent 5de892d commit f2c322a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clockdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ int main(int argc, char **argv)
ctl.hisname, ctl.rtt, ctl.rtt_sigma, ctl.min_rtt,
ctl.measure_delta, ctl.measure_delta1, s);
} else {
printf("%ld %d %d\n", now, ctl.measure_delta, ctl.measure_delta1);
printf("%lld %d %d\n", (long long)now, ctl.measure_delta, ctl.measure_delta1);
}
}
exit(0);
Expand Down

0 comments on commit f2c322a

Please sign in to comment.