Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/File-modification-time/Raku/file-modification-time.raku
Normal file
21
Task/File-modification-time/Raku/file-modification-time.raku
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use NativeCall;
|
||||
|
||||
class utimbuf is repr('CStruct') {
|
||||
has int $.actime;
|
||||
has int $.modtime;
|
||||
|
||||
submethod BUILD(:$atime, :$mtime) {
|
||||
$!actime = $atime;
|
||||
$!modtime = $mtime.to-posix[0].round;
|
||||
}
|
||||
}
|
||||
|
||||
sub sysutime(Str, utimbuf --> int32) is native is symbol('utime') {*}
|
||||
|
||||
sub MAIN (Str $file) {
|
||||
my $mtime = $file.IO.modified orelse .die;
|
||||
|
||||
my $ubuff = utimbuf.new(:atime(time),:mtime($mtime));
|
||||
|
||||
sysutime($file, $ubuff);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue