操作系统:Windows Server 2012 R2 Standart
FS:NTFS

=== perl5

e:\temporary>perl -v
This is perl 5, version 22, subversion 0 (v5.22.0) built for MSWin32-x64-multi-thread

e:\temporary>type ctime.pl
use File::stat;
use Time::Piece;

my $fn1 = 't:\temporary\tia\Энергия\print.pdf';
my $fn2 = 't:\temporary\tia\Энергия\kl_to_1c.txt';
for ($fn1,$fn2) {
    my $fs = stat($_);
    print "$_\n";
    print 'changed  ',gmtime($fs->ctime)->datetime,"\n";
    print 'modified ',gmtime($fs->mtime)->datetime,"\n";
    print 'accessed ',gmtime($fs->atime)->datetime,"\n";
}

e:\temporary>perl ctime.pl
t:\temporary\tia\Энергия\print.pdf
changed  2016-07-01T03:48:22 <== (1)
modified 2016-05-04T03:03:08
accessed 2016-07-01T03:48:22
t:\temporary\tia\Энергия\kl_to_1c.txt
changed  2016-07-01T03:48:22 <== (3)
modified 2016-07-01T03:11:00
accessed 2016-07-01T03:48:22


=== perl6

e:\temporary>perl6 -v
This is Rakudo version 2016.04 built on MoarVM version 2016.04
implementing Perl 6.c.

e:\temporary>type ctime.pl6
use v6;
my $fio1 = 't:\temporary\tia\Энергия\print.pdf'.IO;
my $fio2 = 't:\temporary\tia\Энергия\kl_to_1c.txt'.IO;

for $fio1,$fio2 {
    say .path;
    say 'changed  ', .changed.DateTime.truncated-to('second');
    say 'modified ', .modified.DateTime.truncated-to('second');
    say 'accessed ', .accessed.DateTime.truncated-to('second');

}

e:\temporary>perl6 ctime.pl6
t:\temporary\tia\Энергия\print.pdf
changed  2016-05-04T03:03:08Z <== (2)
modified 2016-05-04T03:03:08Z
accessed 2016-07-01T03:48:22Z
t:\temporary\tia\Энергия\kl_to_1c.txt
changed  2016-07-01T05:46:12Z <== (4)
modified 2016-07-01T03:11:00Z
accessed 2016-07-01T03:48:22Z


为什么(1),(2)和(3),(4)不同?
没关系?

再现(1),(2)。
1)使用文本编辑器创建文件。差异将以秒为单位。
从perl5:

 changed  2016-06-30T16:38:42
 modified 2016-06-30T16:38:48
 accessed 2016-06-30T16:38:42


从perl6:

 changed  2016-06-30T16:38:48Z
 modified 2016-06-30T16:38:48Z
 accessed 2016-06-30T16:38:42Z


2)几分钟后编辑此文件。差异将更加明显。
从perl5:

  changed  2016-06-30T16:38:42 <==
  modified 2016-06-30T16:49:17
  accessed 2016-06-30T16:38:42


从perl6:

 changed  2016-06-30T16:49:17Z <==
 modified 2016-06-30T16:49:17Z
 accessed 2016-06-30T16:38:42Z


来自cgwin / babun的“ stat”:

{ ~ }  » stat t:/temporary/tia/Энергия/print.pdf                                                ~
  File: ‘t:/temporary/tia/Энергия/print.pdf’
  Size: 81595           Blocks: 80         IO Block: 65536  regular file
Device: dfe235h/14672437d       Inode: 26458647810801926  Links: 1
Access: (0644/-rw-r--r--)  Uid: (  500/Administrator)   Gid: (  513/Domain Users)
Access: 2016-07-01 09:48:22.578784100 +0600
Modify: 2016-05-04 09:03:08.602697600 +0600
Change: 2016-05-04 09:03:08.602697600 +0600
 Birth: 2016-07-01 09:48:22.578784100 +0600

{ ~ }  » stat t:/temporary/tia/Энергия/kl_to_1c.txt                                           ~ 1
  File: ‘t:/temporary/tia/Энергия/kl_to_1c.txt’
  Size: 4596            Blocks: 8          IO Block: 65536  regular file
Device: dfe235h/14672437d       Inode: 24769797950537989  Links: 1
Access: (0644/-rw-r--r--)  Uid: (  500/Administrator)   Gid: (  513/Domain Users)
Access: 2016-07-01 09:48:22.563158800 +0600
Modify: 2016-07-01 09:11:00.585249200 +0600
Change: 2016-07-01 11:46:12.037712200 +0600
 Birth: 2016-07-01 09:48:22.563158800 +0600

最佳答案

这可能是源自libuv的错误(请参阅:https://irclog.perlgeek.de/perl6/2016-07-11#i_12818620)。即使是这样,也不应将其插入Perl 6代码中。请针对Rakudo提交错误报告(请参阅:http://rakudo.org/tickets/)。

关于raku - 在perl 5和perl 6下文件ctime不同,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38122891/

10-12 07:34