summaryrefslogtreecommitdiff
path: root/src/libstddjb/localtm_from_ltm64.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-02-02 00:59:36 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-02-02 00:59:36 +0000
commit8375d5c12b63ec99141bfb1b70c0f2cfe70b564b (patch)
tree5b0538258a2d94f6152d9ba04b799d2e2838f59f /src/libstddjb/localtm_from_ltm64.c
parente7d52871f6e6e0a9269eb552e814689c3cd2d701 (diff)
downloadskalibs-8375d5c12b63ec99141bfb1b70c0f2cfe70b564b.tar.xz
Fix HASSIGNEDSIGNED sysdeps macros, add localtm_from_ltm64 tolerance for 64-bit time_t
Diffstat (limited to 'src/libstddjb/localtm_from_ltm64.c')
-rw-r--r--src/libstddjb/localtm_from_ltm64.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstddjb/localtm_from_ltm64.c b/src/libstddjb/localtm_from_ltm64.c
index e2cc382..76703da 100644
--- a/src/libstddjb/localtm_from_ltm64.c
+++ b/src/libstddjb/localtm_from_ltm64.c
@@ -5,6 +5,7 @@
#define _BSD_SOURCE
#endif
+#include <skalibs/sysdeps.h>
#include <errno.h>
#include <time.h>
#include <skalibs/uint64.h>
@@ -15,7 +16,9 @@ int localtm_from_ltm64 (struct tm *l, uint64_t uu, int tz)
{
if (uu < TAI_MAGIC) return (errno = EINVAL, 0) ;
uu -= TAI_MAGIC ;
+#if SKALIBS_SIZEOFTIME != 8
if (uu > 0xFFFFFFFFUL) return (errno = EOVERFLOW, 0) ;
+#endif
{
time_t u = (time_t)uu ;
if (tz ? !localtime_r(&u, l) : !gmtime_r(&u, l)) return 0 ;