From c8554ebc0c0c67b4f691a760b5e844f974e92ddc Mon Sep 17 00:00:00 2001 From: alaviss Date: Mon, 22 Jun 2020 07:23:24 +0000 Subject: 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. --- lib/posix/posix_other.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/posix') 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: "".} = distinct clong + Time* {.importc: "time_t", header: "".} = distinct ( + when defined(nimUse64BitCTime): + int64 + else: + clong + ) Timespec* {.importc: "struct timespec", header: "", final, pure.} = object ## struct timespec -- cgit 1.4.1-2-gfad0