diff options
author | Oscar Nihlgård <oscarnihlgard@gmail.com> | 2018-10-19 22:33:40 +0200 |
---|---|---|
committer | Oscar Nihlgård <oscarnihlgard@gmail.com> | 2018-10-19 22:33:40 +0200 |
commit | 81f5427ed4e69bcaaad9f2f5cd7ab71e1571f3ca (patch) | |
tree | 757e2ef222280faf06efd9f7e2ff25c38a8d51de /lib | |
parent | fc625091e0fdc816c6f092c5b86d9b5f79502431 (diff) | |
download | Nim-81f5427ed4e69bcaaad9f2f5cd7ab71e1571f3ca.tar.gz |
Fix times 32-bit issue
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/times.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index a7ccbf6ee..62284c6cb 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -967,11 +967,13 @@ else: return ((0 - tm.toAdjUnix).int, false) return (0, false) - var a = unix.CTime + # In case of a 32-bit time_t, we fallback to the closest available + # timezone information. + var a = clamp(unix, low(CTime), high(CTime)).CTime let tmPtr = localtime(addr(a)) if not tmPtr.isNil: let tm = tmPtr[] - return ((unix - tm.toAdjUnix).int, tm.isdst > 0) + return ((a.int64 - tm.toAdjUnix).int, tm.isdst > 0) return (0, false) proc localZonedTimeFromTime(time: Time): ZonedTime = |