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.

(cherry picked from commit c8554ebc0c)
This commit is contained in:
alaviss
2020-06-22 07:23:24 +00:00
committed by narimiran
parent 90546716dc
commit bcb6d9a763

View File

@@ -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