mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-23 15:55:23 +00:00
windows: prefer 64-bit time_t (#25666)
time_t should be a 64-bit type on all relevant windows CRT versions
including mingw-w64 - MSDN recommends against using the 32-bit version
which only is happens when `_USE_32BIT_TIME_T` is explicitly defined -
instead of guessing (and guessing wrong, as happens with recent mingw
versions), we can simply use the 64-bit version always.
(cherry picked from commit e53058dee0)
This commit is contained in:
@@ -13,11 +13,11 @@ when defined(nimdoc):
|
||||
Time* = Impl ## \
|
||||
## Wrapper for `time_t`. On posix, this is an alias to `posix.Time`.
|
||||
elif defined(windows):
|
||||
when defined(i386) and defined(gcc):
|
||||
type Time* {.importc: "time_t", header: "<time.h>".} = distinct clong
|
||||
else:
|
||||
# newest version of Visual C++ defines time_t to be of 64 bits
|
||||
type Time* {.importc: "time_t", header: "<time.h>".} = distinct int64
|
||||
# Unless _USE_32BIT_TIME_T is defined, time_t is a 64-bit value on both 32
|
||||
# and 64-bit versions of windows:
|
||||
# https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64
|
||||
# For the avoidance of doubt, always use 64-bit version
|
||||
type Time* {.importc: "__time64_t", header: "<time.h>".} = distinct clonglong
|
||||
elif defined(posix):
|
||||
import std/posix
|
||||
export posix.Time
|
||||
Reference in New Issue
Block a user