Skip to content

Commit

Permalink
Consider long long (lld) for time_t (#173)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
micmac1 authored Dec 26, 2023
1 parent 503dba8 commit 13450af
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ dnl AC_CHECK_TYPE(uint64_t, unsigned long long)

AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long int)
AC_CHECK_SIZEOF(long long int)
AC_CHECK_SIZEOF(time_t)
case "$ac_cv_sizeof_time_t" in
''|0) AC_MSG_ERROR([Could not find time_t type]);;
$ac_cv_sizeof_int) AC_DEFINE([PRI_time_t], ["d"], [printf format for time_t]);;
$ac_cv_sizeof_long_int) AC_DEFINE([PRI_time_t], ["ld"], [printf format for time_t]);;
$ac_cv_sizeof_long_long_int) AC_DEFINE([PRI_time_t], ["lld"], [printf format for time_t]);;
*) AC_MSG_ERROR([Could not find match size of time_t to printf format])
esac

Expand Down

0 comments on commit 13450af

Please sign in to comment.