Hello Peppe757,
I've found another discussion regards this topic here. In this article there is an interesting link to Windows file times.
So as it seems ctime does not give what you want.
In the 'Windows file times' link the function GetFileTime is mentioned so looking for that I found the module Win32API::File::Time that has this function. So maybe you can try to use that one instead.
edit: I found another module that I actually like better. The module is called Win32::UTCFileTime. I have created the following sample program for testing:
use strict ; use warnings ; use DateTime ; use Win32::UTCFileTime qw(alt_stat $ErrStr) ; my $file = ".\\testFileTime2.pl" ; my @stats = alt_stat( $file ) or die "alt_stat() failed: $ErrStr\n" ; print "ctime = $stats[10]\n" ; my $dt = DateTime->from_epoch( epoch => $stats[10], time_zone => 'UTC' + ) ; print $dt->datetime . "\n" ; __END__ ctime = 1530825924 2018-07-05T21:25:24
edit 2: Anonymous Monk asked: "But is it any different from built-in stat". The answer can be found in the documentation: Note that the 11th element of the 13-element list returned by stat() is the creation time on Win32, not the inode change time as it is on many other operating systems. Therefore, neither Perl's built-in utime() function nor this replacement function set that value to the current time as would happen on other operating systems.
In reply to Re: Getting the correct ctime for a file on Windows 10
by Veltro
in thread Getting the correct ctime for a file on Windows 10
by Peppe757
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |