1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2026-10-23 06:08:56 +03:00

Default to 64-bit time_t on x86

With msvcrt, mingw-w64 defaults x86 to a 32-bit time_t, so ordinary
programs built today fail in January 2038. A new header patch makes
64-bit time_t the default, as with UCRT and MSVC, and everything in the
kit is built that way, including the kit's own tools. The 64-bit time
functions are emulated in libmsvcrt-os.a on top of XP-era imports, so
programs still run on Windows XP. Use _TIME_BITS=32 or
_USE_32BIT_TIME_T to opt out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Christopher Wellons
2026-10-18 10:08:23 -04:00
parent cfd8597704
commit 3eff223c6d
2 changed files with 23 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
default-win32-winnt.patch
imp-strtof_l.patch
gendef-silent.patch
time64-default.patch

View File

@@ -0,0 +1,22 @@
headers: default to 64-bit time_t on x86 msvcrt
On i686 with msvcrt, mingw-w64 defaults to a 32-bit time_t, so ordinary
programs built today stop working in January 2038. Default to 64-bit
time_t instead, as UCRT and MSVC already do. The 64-bit time functions
come from libmsvcrt-os.a emulation on top of XP-era imports, so this
does not raise the minimum Windows version.
Programs can still request 32-bit time_t with _TIME_BITS=32 or by
defining _USE_32BIT_TIME_T. __MINGW_USE_VC2005_COMPAT is now redundant.
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -394,7 +394,7 @@
#ifndef __WIDL__
-#if defined (_WIN32) && !defined (_WIN64) && !defined (__MINGW_USE_VC2005_COMPAT) && !defined (_UCRT) && !(defined (_TIME_BITS) && _TIME_BITS == 64)
+#if defined (_WIN32) && !defined (_WIN64) && !defined (_UCRT) && defined (_TIME_BITS) && _TIME_BITS == 32
#ifndef _USE_32BIT_TIME_T
#define _USE_32BIT_TIME_T
#endif