kphp icon indicating copy to clipboard operation
kphp copied to clipboard

Implemented touch() function.

Open comm644 opened this issue 2 years ago • 0 comments

Please integrate function touch().

I don't understood how to add unit-tests , but i wrote it. Please add.

unit-test:

<?php
$filename = tempnam("/tmp", "ktouch");
$time1 = filemtime($filename);
sleep( 3 );
$rc = touch($filename, time()-30, time()-50);
if  (!$rc) {
        throw new \RuntimeException("touch() failed: $filename. rc=$rc");
}

$time2 = filemtime($filename);

if ( $time1 === $time2 ) throw new \RuntimeException("touch() does not work: $time1 !== $time2");
echo "ok\n";

comm644 avatar Mar 11 '23 19:03 comm644