From 3eff223c6d014908360e92d7951def07e166ef6c Mon Sep 17 00:00:00 2001 From: Christopher Wellons Date: Sun, 18 Oct 2026 10:08:23 -0400 Subject: [PATCH] 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 --- src/mingw/series | 1 + src/mingw/time64-default.patch | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/mingw/time64-default.patch diff --git a/src/mingw/series b/src/mingw/series index 53aeaf6..e2456e5 100644 --- a/src/mingw/series +++ b/src/mingw/series @@ -1,3 +1,4 @@ default-win32-winnt.patch imp-strtof_l.patch gendef-silent.patch +time64-default.patch diff --git a/src/mingw/time64-default.patch b/src/mingw/time64-default.patch new file mode 100644 index 0000000..e4b5131 --- /dev/null +++ b/src/mingw/time64-default.patch @@ -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