summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authoralaviss <leorize+oss@disroot.org>2020-06-22 07:23:24 +0000
committerGitHub <noreply@github.com>2020-06-22 09:23:24 +0200
commitc8554ebc0c0c67b4f691a760b5e844f974e92ddc (patch)
tree2b88663e1e9023cbb7825705a321332e8c7d58ba /lib
parent1e484ed62b499432883575e6b29c930874377d7a (diff)
downloadNim-c8554ebc0c0c67b4f691a760b5e844f974e92ddc.tar.gz
posix_other: add define to force time_t to 64 bit [backport] (#14753)
This is a temporary remedy for time_t transition to 64 bit on newer
Linux libc (musl >= 1.2.0, glibc >= 2.32).

In the future we might want to move away from libc, or figure out a way
to reliably detect the real size of C types at compile time, both of
which are difficult.
Diffstat (limited to 'lib')
-rw-r--r--lib/posix/posix_other.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/posix/posix_other.nim b/lib/posix/posix_other.nim
index 919d564d3..59ae9c8f7 100644
--- a/lib/posix/posix_other.nim
+++ b/lib/posix/posix_other.nim
@@ -32,7 +32,12 @@ type
   SocketHandle* = distinct cint # The type used to represent socket descriptors
 
 type
-  Time* {.importc: "time_t", header: "<time.h>".} = distinct clong
+  Time* {.importc: "time_t", header: "<time.h>".} = distinct (
+    when defined(nimUse64BitCTime):
+      int64
+    else:
+      clong
+  )
 
   Timespec* {.importc: "struct timespec",
                header: "<time.h>", final, pure.} = object ## struct timespec