Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider long long (lld) for time_t #173

Merged
merged 1 commit into from
Dec 26, 2023
Merged

Conversation

micmac1
Copy link

@micmac1 micmac1 commented Dec 26, 2023

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

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

Signed-off-by: Sebastian Kemper <[email protected]>
@micmac1
Copy link
Author

micmac1 commented Dec 26, 2023

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

micmac1 added a commit to micmac1/telephony that referenced this pull request Dec 26, 2023
Closes: openwrt#837

The extra patch was submitted upstream for inclusion, see [1].

[1] wdoekes/asterisk-chan-dongle#173

Signed-off-by: Sebastian Kemper <[email protected]>
@wdoekes wdoekes merged commit 13450af into wdoekes:master Dec 26, 2023
0 of 3 checks passed
@wdoekes
Copy link
Owner

wdoekes commented Dec 26, 2023

LGTM. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants