From: Matija Skala Date: Fri, 19 May 2017 12:36:12 +0000 (+0200) Subject: timesync/timesyncd-manager: fix format-specifier issues X-Git-Tag: chiark/234.4-1+devuan1.1+iwj1~124 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=bb81dc92d38d5b1336ad842ef5f43f178aafcbb5;p=elogind.git timesync/timesyncd-manager: fix format-specifier issues timex::time::tv_usec and timex::freq can have different sizes depending on the host architecture. On x32 in particular, it is 8 bytes long while the long int type is only 4 bytes long. Hence, using li as a format specifier will trigger a format error. Thus, introduce a new format specifier PRI_TIMEX which is defined as PRIi64 on x32 and li everywhere else. --- diff --git a/src/basic/format-util.h b/src/basic/format-util.h index 39a185f59..ae42a8f89 100644 --- a/src/basic/format-util.h +++ b/src/basic/format-util.h @@ -54,6 +54,12 @@ # error Unknown time_t size #endif +#if defined __x86_64__ && defined __ILP32__ +# define PRI_TIMEX PRIi64 +#else +# define PRI_TIMEX "li" +#endif + #if SIZEOF_RLIM_T == 8 # define RLIM_FMT "%" PRIu64 #elif SIZEOF_RLIM_T == 4