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.
This commit is contained in:
alaviss 2020-06-22 07:23:24 +00:00 • committed by GitHub
commit c8554ebc0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,7 +32,12 @@ type
SocketHandle* = distinct cint # The type used to represent socket descriptors SocketHandle* = distinct cint # The type used to represent socket descriptors
type 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", Timespec* {.importc: "struct timespec",
header: "<time.h>", final, pure.} = object ## struct timespec header: "<time.h>", final, pure.} = object ## struct timespec