Dosya sistemi ext4 (Ubuntu gibi daha yeni Unix / Linux dağıtımları ortak) veya ntfs (Windows) ise, mtime var alt-ikinci kesinlik .
Dosya sistemi ext3 (veya belki de diğerleri, bu bir süre önce standart oldu ve hala RHEL tarafından kullanılan) ise, mtime sadece yakın ikinci saklanır. Belki o eski varsayılan neden PHP sadece destekleri mtime yakın ikinci.
PHP değerini almak için, PHP'nin kendisi bunu desteklemediği, harici util aramak gerekir.
(Ben sadece bir İngilizce yerel bir sistemde aşağıdaki test ettik, ve "okunabilir insan" çıktı stat farklı olabilir, ya da strtotime davranış İngilizce olmayan yerel farklı olabilir. Bu, herhangi bir zaman dilimi içinde iyi çalışır çıktısı olarak stat strtotime tarafından onurlandırıldı bir zaman dilimi belirtici içerir.) olmalıdır
class FileModTimeHelper
{
/**
* Returns the file mtime for the specified file, in the format returned by microtime()
*
* On file systems which do not support sub-second mtime precision (such as ext3), the value
* will be rounded to the nearest second.
*
* There must be a posix standard "stat" on your path (e.g. on unix or Windows with Cygwin)
*
* @param $filename string the name of the file
* @return string like microtime()
*/
public static function getFileModMicrotime($filename)
{
$stat = `stat --format=%y $filename`;
$patt = '/^(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)\.(\d+) (.*)$/';
if (!preg_match($patt, $stat, $matches)) {
throw new \Exception("Unrecognised output from stat. Expecting something like '$patt', found: '$stat'");
}
$mtimeSeconds = strtotime("{$matches[1]} {$matches[3]}");
$mtimeMillis = $matches[2];
return "$mtimeSeconds.$mtimeMillis";
}
}