From ccc9992840598e149dd73d008501ff3887c484ec Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Wed, 10 Aug 2022 14:26:24 -0400 Subject: test/snippets: fix time.c compiler error on 32-bit arches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/snippets/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/snippets/time.c b/test/snippets/time.c index 7153588..568d075 100644 --- a/test/snippets/time.c +++ b/test/snippets/time.c @@ -1,2 +1,2 @@ time_t t = time(NULL); -printf("[%s] time() yielded %zd\n", where, t); +printf("[%s] time() yielded %lu\n", where, (unsigned long)t); -- cgit v1.2.1