Why is time_t defined as a 32-bit type on Windows?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Aug 5 16:19:27 UTC 2020
On Wednesday, 5 August 2020 at 16:13:19 UTC, Andrej Mitrovic
wrote:
> ```
> C:\dev> rdmd -m64 --eval="import core.stdc.time;
> writeln(time_t.sizeof);"
> 4
> ```
>
> According to MSDN this should not be the case:
>
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64?view=vs-2019
>
>> time is a wrapper for _time64 and **time_t is, by default,
>> equivalent to __time64_t**.
>
> But in Druntime it's defined as a 32-bit type:
> https://github.com/dlang/druntime/blob/349d63750d55d078426d4f433cba512625f8a3a3/src/core/sys/windows/stdc/time.d#L42
It looks like this definition was there from at least 2008 (!!),
and probably earlier than that but I don't have the SVN sources:
https://github.com/dlang/druntime/blob/6837c0cd426f7e828aec1a2bdc941ac9b722dd14/import/stdc/time.d#L49
So basically, just around the time the first 64-bit version of
Windows was released. I'm guessing it was just neglected..
More information about the Digitalmars-d-learn
mailing list