On Friday 16 January 2026 16:04:15 LIU Hao wrote:
> 在 2025-12-29 01:35, Pali Rohár 写道:
> > ---
> >   mingw-w64-crt/Makefile.am              |  1 +
> >   mingw-w64-crt/lib-common/msvcrt.def.in |  2 +-
> >   mingw-w64-crt/misc/_time32.c           | 24 ++++++++++++++++++++++++
> >   3 files changed, 26 insertions(+), 1 deletion(-)
> >   create mode 100644 mingw-w64-crt/misc/_time32.c
> > 
> > diff --git a/mingw-w64-crt/misc/_time32.c b/mingw-w64-crt/misc/_time32.c
> > new file mode 100644
> > index 000000000000..1855ee225780
> > --- /dev/null
> > +++ b/mingw-w64-crt/misc/_time32.c
> > @@ -0,0 +1,24 @@
> > +/**
> > + * This file has no copyright assigned and is placed in the Public Domain.
> > + * This file is part of the mingw-w64 runtime package.
> > + * No warranty is given; refer to the file DISCLAIMER.PD within this 
> > package.
> > + */
> > +
> > +#include <time.h>
> > +#include <stdint.h>
> > +
> > +static __time32_t __cdecl emu__time32(__time32_t *timeptr)
> > +{
> > +    __time64_t time64 = _time64(NULL);
> > +    if (time64 > INT32_MAX)
> > +        time64 = -1;
> 
> And likewise, this should set errno to EOVERFLOW and return.

I'm not sure if the real msvcrt.dll time32 function is doing it. If it
not doing it then our emulation wrapper should not do it too, so we
would have same behavior whether the real or emulated function is used.

I will recheck this case on different msvcrt.dll versions to see what is
the real behavior.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to