On 2016-04-25, Marc de Bourget <
marcde...@gmail.com> wrote:
> I have only basic knowledge in C but I think the actual problem is the time_t data type which uses a signed 32 bit integer or a 64 bit integer.
>
> May it be possible to set it to a 64 bit integer by GAWK developers or
> does this fail due to compiler limits?
No, you can't just set time_t to whatever you want, and it won't help,
because the library functions for manipulating time are compiled with
a 32 bit time_t.
"PC's" are not affected by a 2038 year problem. Only C and C++ programs
that use a 32 bit time_t which is based on the "seconds since January 1,
1970" Unix representation, and some operating systems which use that
internally.
Windows doesn't use this representation at the operating system level.
The Windows API has something called FILETIME:
typedef struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
This is a structure of two 32-bit words, so effectively a 64 bit
time. This counts in units of hundreds of nanoseconds (0.1
microseconds) since January 1, 1601, UTC.
A C compiler on Windows, and its library, could define time_t as a 64
bit type which maps to FILETIME; ISO C doesn't specify the details of
the time_t representation, only that it's an "arithmetic type
capable of representing times".
However, many C programs (especially ones ported from Unix) will
break if time_t doesn't measure seconds since January 1, 1970.
So for instance Microsoft's Visual C run time library defines time_t
in the Unix way.
Unix-like operating systems actually use time_t at a deeper level;
like in the gettimeofday system call and others. Traditional 32 bit
Unixes have a 2038 year problem affecting their kernels.