This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Win32: implement our own stat(), and hence our own utime
This fixes at least two problems:
- unlike UCRT, the MSVCRT used for gcc builds has a bug converting
a FILETIME in an unlike current DST state, returning a time
offset by an hour. Fixes GH #6080
- the MSVCRT apparently uses FindFirstFile() to fetch file
information, but this doesn't follow symlinks(), so stat()
ends up returning information about the symlink(), not the
underlying file. This isn't an issue with the UCRT which
opens the file as this implementation does.
Currently this code calculates the time_t for st_*time, and the
other way for utime() using a simple multiplication and offset
between time_t and FILETIME values, but this may be incorrect
if leap seconds are enabled.
This code also requires Vista or later.
Some of this is based on code by Tomasz Konojacki (xenu).