wolfcw / libfaketime

libfaketime modifies the system time for a single application
https://github.com/wolfcw/libfaketime
GNU General Public License v2.0
2.71k stars 325 forks source link

test/snippets: fix time.c compiler error on 32-bit arches #406

Closed enr0n closed 2 years ago

enr0n commented 2 years ago

Cast t to unsigned long and use the %lu format specifier instead of %zd. This is more portable to 32-bit arches, avoiding the following compiler error:

snippets/time.c:2:31: error: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘time_t’ {aka ‘long int’} [-Werror=format=] 2 printf("[%s] time() yielded %zd\n", where, t); ~~^ ~
int time_t {aka long int}
%ld

cc1: all warnings being treated as errors

wolfcw commented 2 years ago

nice catch, thanks!