Using %ld to print time_t will work fine on 64 bit platforms, however
now musl libc defines time_t to be 64 even on 32bit platforms.
This will make the compilation fail with:
mdio.c: In function 'mdio_common_bench_cb':
mdio.c:555:27: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'time_t' {aka 'long long int'} [-Werror=format=]
555 | printf("%ld.%2.2lds\n", end.tv_sec, end.tv_nsec / 10000000);
| ~~^ ~~~~~~~~~~
| | |
| long int time_t {aka long long int}
| %lld
So, replace the %ld in prints with the PRId64 from inttypes.h and cast
tv_sec and tv_nsec to int64_t.
This makes it compile and work on 32 bit ARMv7 fine.
Using %ld to print time_t will work fine on 64 bit platforms, however now musl libc defines time_t to be 64 even on 32bit platforms.
This will make the compilation fail with:
So, replace the %ld in prints with the PRId64 from inttypes.h and cast tv_sec and tv_nsec to int64_t.
This makes it compile and work on 32 bit ARMv7 fine.
Signed-off-by: Robert Marko robert.marko@sartura.hr