Comparing Unix timestamps
<p>I need to compare two Unix timestamps and I'm having trouble with the math.  I know a Unix timestamp is the number of seconds since January 1, 1970.  But I'm doing something wrong with the math.  I'm trying to detect whether it has been 3 minutes from when the file was last modified.  Here is my code:</p>

<pre><code>if (file_exists($filename)) {
    $filemodtime = filemtime($filename);
}

$three_min_from_now = mktime(0, 3, 0, 0, 0, 0);

if (time() &gt;= $filemodtime + $three_min_from_now) {
     // do stuff
} else {
     // do other stuff
}
</code></pre>

<p>But the else clause keeps being satisfied, not the if, even when the if should be true.  I think the issue is my math.  Can someone help?  Thanks.</p>
