classes/phing/system/io/FileSystem.php
public function compareMTimes($file1, $file2)
    {
        $mtime1 = filemtime($file1);
        $mtime2 = filemtime($file2);

        if ($mtime1 === false) { // FAILED. Log and return err.
            // Add error from php to end of log message. $php_errormsg.
            $msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file1.";
            throw new Exception($msg);
        } elseif ($mtime2 === false) { // FAILED. Log and return err.
            // Add error from php to end of log message. $php_errormsg.
            $msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file2.";
            throw new Exception($msg);
        } else { // Worked. Log and return compare.
            // Compare mtimes.
            if ($mtime1 == $mtime2) {
                return 0;
            } else {
                return ($mtime1 < $mtime2) ? -1 : 1;
            } // end compare
        }
    }
public function compareMTimes($file1, $file2)
    {
        $mtime1 = filemtime($file1);
        $mtime2 = filemtime($file2);

        if ($mtime1 === false) { // FAILED. Log and return err.
            // Add error from php to end of log message. $php_errormsg.
            $msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file1.";
            throw new Exception($msg);
        } elseif ($mtime2 === false) { // FAILED. Log and return err.
            // Add error from php to end of log message. $php_errormsg.
            $msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file2.";
            throw new Exception($msg);
        } else { // Worked. Log and return compare.
            // Compare mtimes.
            if ($mtime1 == $mtime2) {
                return 0;
            } else {
                return ($mtime1 < $mtime2) ? -1 : 1;
            } // end compare
        }
    }
public function compareMTimes ( $ file1 , $ file2 ) { $ mtime1 = filemtime ( $ file1 ) ; $ mtime2 = filemtime ( $ file2 ) ; if ( $ mtime1 === false ) { // FAILED. Log and return err. // Add error from php to end of log message. $php_errormsg. $ msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file1." ; throw new Exception ( $ msg ) ; } elseif ( $ mtime2 === false ) { // FAILED. Log and return err. // Add error from php to end of log message. $php_errormsg. $ msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file2." ; throw new Exception ( $ msg ) ; } else { // Worked. Log and return compare. // Compare mtimes. if ( $ mtime1 == $ mtime2 ) { return 0 ; } else { return ( $ mtime1 < $ mtime2 ) ? - 1 : 1 ; } // end compare } }
Compare the modified time of two files.

@param string $file1 Path and name of file1.
@param string $file2 Path and name of file2.

@return int  1 if file1 is newer.
-1 if file2 is newer.
0 if files have the same time.
Err object on failure.

@throws Exception - if cannot get modified time of either file.
Compare the modified time of two files .