CRT DLL libraries older than msvcrt40 use internally in all time functions dst bias of one hour. These DLL libraries do not export _dstbias variable and neither __dstbias() and __p__dstbias() functions.
So for these CRT import libraries define import variable _dstbias with fixed value -3600 (one hour) and include __dstbias() and __p__dstbias() compatible functions (which returns pointer to _dstbias import variable). With these definitions, it is possible to compile and link applications which uses _dstbias (included from mingw-w64 time.h and defined as call to __dstbias() function) with crtdll.dll, msvcrt10.dll or msvcrt20.dll. And application via _dstbias will receive the dst bias which the CRT library is currently using (like when linked with any other new CRT library). --- mingw-w64-crt/Makefile.am | 2 ++ mingw-w64-crt/misc/_dstbias.c | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 mingw-w64-crt/misc/_dstbias.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 423e233ac40f..7ebbd7c306d8 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -750,7 +750,9 @@ src_pre_msvcrt20=\ stdio/iob_func.c src_pre_msvcrt40=\ + misc/__dstbias.c \ misc/__set_app_type.c \ + misc/_dstbias.c \ misc/dummy__setusermatherr.c \ stdio/_filelengthi64.c \ stdio/fgetpos.c \ diff --git a/mingw-w64-crt/misc/_dstbias.c b/mingw-w64-crt/misc/_dstbias.c new file mode 100644 index 000000000000..d6914c1c7d27 --- /dev/null +++ b/mingw-w64-crt/misc/_dstbias.c @@ -0,0 +1,11 @@ +/** + * 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 <_mingw.h> + +#undef _dstbias +static long _dstbias = -3600; /* pre-msvcrt40 uses fixed one hour dst bias */ +long * __MINGW_IMP_SYMBOL(_dstbias) = &_dstbias; -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public