NAME

   Win32::UTCFileTime - Get/set UTC file times with stat/utime on Win32

SYNOPSIS

   # Override built-in stat()/lstat()/utime() within current package only:
   use Win32::UTCFileTime qw(:DEFAULT $ErrStr);
   @stats = stat $file or die "stat() failed: $ErrStr\n";
   $now = time;
   utime $now, $now, $file;

   # Or, override built-in stat()/lstat()/utime() within all packages:
   use Win32::UTCFileTime qw(:globally);
   ...

   # Use an alternative implementation of stat() instead:
   use Win32::UTCFileTime qw(alt_stat $ErrStr);
   @stats = alt_stat($file) or die "alt_stat() failed: $ErrStr\n";

DESCRIPTION

   NOTE: In Perl 5.33.5, the built-in stat() and utime() functions were
   rewritten (and a proper implementation of lstat() was added) in such a way
   that the UTC file time handling is now correct (including the case of
   utime() being used on directories) regardless of which compiler perl is
   built with, thus rendering this module wholly redundant for Perl 5.33.5 or
   later. The remainder of this man page is written from the perspective of
   earlier versions of Perl.

   This module provides replacements for Perl's built-in stat() and utime()
   functions that respectively get and set "correct" UTC file times instead of
   the erroneous values read and written by Microsoft's implementation of
   stat(2) and utime(2), which Perl's built-in functions inherit on Win32 when
   built with the Microsoft C library in Visual Studio 2013 (VC12) or earlier.

   The bugs in the Microsoft C library have since been fixed, so there is
   mostly no need for this module if you build perl with Visual Studio 2015
   (VC14.0) or later, except that the use of utime() on directories is a Perl
   extension over the underlying Microsoft C library function and still has
   incorrect UTC file time handling even for perls built with VC14.0 or later.

INSTALLATION

   See the INSTALL file.

COPYRIGHT

   Copyright (C) 2003-2008, 2012-2015, 2020 Steve Hay. All rights reserved.
   Portions Copyright (C) 2001 Jonathan M Gilligan. Used with permission.
   Portions Copyright (C) 2001 Tony M Hoyle. Used with permission.

LICENCE

   This distribution is free software; you can redistribute it and/or modify it
   under the same terms as Perl itself, i.e. under the terms of either the GNU
   General Public License or the Artistic License, as specified in the LICENCE
   file.