MinGW Notification List
mingw****@lists*****
Sun Feb 11 07:01:36 JST 2018
#37938: Conflicts in time_t type definition between MSVCRT.DLL, UCRTBASE.DLL, and VC++ non-free runtimes Open Date: 2018-02-03 18:05 Last Update: 2018-02-10 22:01 URL for this Ticket: https://osdn.net//projects/mingw/ticket/37938 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=37938 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2018-02-10 22:01 Updated by: keith Comment: For the record, the output from chkime.c, after compiling it, and running it on 32-bit WinXP-SP2, is: $ /e/chktime Seconds elapsed since the beginning of the unix epoch, as reported by MSVCRT.DLL time functions with time_t interpreted as:-- Uninterpreted [*] 32-bit (__time32_t) 64-bit (__time64_t) ------------------ -------------------- -------------------- time(): 0xaaaaaaaa5a7f4a1e +1518291486 -6148914692581537250 _time32(): *** function not supported *** _time64(): 0x000000005a7f4a1e +1518291486 +1518291486 --------- ------------------ -------------------- -------------------- [*] This is a hexadecimal representation of the content of the 64-bit results buffer, AFTER the function call; note that this was filled with 0xaa bytes BEFORE the function call, and that any bytes which retain this value after the call may be assumed to have remained untouched, when calling the specified function. As can clearly be seen, attempting to interpret the time_t value returned by the generic time() function, as a 64-bit entity, (as the Microsoft documentation would have us believe it should be), results in complete garbage! --------------------------------------------------------------------- Ticket Status: Reporter: keith Owner: keith Type: Issues Status: Open [Owner assigned] Priority: 5 - Medium MileStone: (None) Component: WSL Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: According to this Microsoft on-line documentation: In versions of Visual C++ and Microsoft C/C++ before Visual C++ 2005, time_t was a long int (32 bits) and hence could not be used for dates past 3:14:07 January 19, 2038, UTC. time_t is now equivalent to __time64_t by default, but defining _USE_32BIT_TIME_T changes time_t to __time32_t and forces many time functions to call versions that take the 32-bit time_t. For more information, see Standard Types and comments in the documentation for the individual time functions. While this may be true, for applications which are built using Microsoft's Visual C++, (specifically from the 2005 version onward), and linked with the accompanying non-free versions of Microsoft's C-Runtime library, (from MSVCR80.DLL onward, and perhaps also with the pseudo-free UCRTBASE.DLL), it is manifestly untrue for applications which are linked with the pseudo-free MSVCRT.DLL, (the normal case for MinGW applications), as it is for applications which are built with, and linked with the C-Runtime libraries which accompanied, earlier (legacy) versions of Microsoft's Visual C++, (i.e. applications which are linked with Microsoft's non-free runtime libraries pre-dating MSVCR80.DLL). We need to engineer a time management API which will accommodate the disparities between MSVCRT.DLL, UCRTBASE.DLL, and Microsoft's post-2005 Visual C++ implementations of various time management functions, and we must recognise that our API cannot blindly conform to the above paragraph from Microsoft's current documentation. -- Ticket information of MinGW - Minimalist GNU for Windows project MinGW - Minimalist GNU for Windows Project is hosted on OSDN Project URL: https://osdn.net/projects/mingw/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net//projects/mingw/ticket/37938 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=37938