wdoekes / asterisk-chan-dongle

chan_dongle channel driver for Huawei UMTS cards, works with Asterisk 14+
Other
296 stars 104 forks source link

Consider long long (lld) for time_t #173

Closed micmac1 closed 6 months ago

micmac1 commented 6 months ago

Hi all,

I was getting ready to bump the OpenWrt package to the latest git, only to find this error:

checking for ssize_t... (cached) yes
checking for uint64_t... yes
checking size of int... (cached) 4
checking size of long int... (cached) 4
checking size of time_t... 8
configure: error: Could not find match size of time_t to printf format

We've seen similar issues in the past in OpenWrt, after musl was updated to 1.2.

Some libc implementations are shifting toward using 64-bit time_t for all arches to solve the year 2038 problem. musl is one of them, see [1].

So when compiling for a 32-bit arch time_t will be long long. This commit adds this option.

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

micmac1 commented 6 months ago

Just for comparison, after applying this patch:

checking for uint64_t... yes
checking size of int... (cached) 4
checking size of long int... (cached) 4
checking size of long long int... 8
checking size of time_t... 8

And config.h content:

/* printf format for time_t */
#define PRI_time_t "lld"

/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4

/* The size of `long int', as computed by sizeof. */
#define SIZEOF_LONG_INT 4

/* The size of `long long int', as computed by sizeof. */
#define SIZEOF_LONG_LONG_INT 8

/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 8
wdoekes commented 6 months ago

LGTM. Thanks!