<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_19262"> <div class="blockcode"> <div id="code_I2G"><ol> <li><?php<li>function relativeTime($time = false, $limit = 86400, $format = 'g:i A M jS') {<li>if (empty($time) || (!is_string($time) && !is_numeric($time))) $time = time();<li>elseif (is_string($time)) $time = strtotime($time);<li><li>$now = time();<li>$relative = '';<li><li>if ($time === $now) $relative = 'now';<li>elseif ($time > $now) $relative = 'in the future';</li> <li>else {</li> <li>$diff = $now - $time;</li> <li> <li>if ($diff >= $limit) $relative = date($format, $time);</li> <li>elseif ($diff < 60) {</li> <li>$relative = 'less than one minute ago';</li> <li>} elseif (($minutes = ceil($diff/60)) < 60) {</li> <li>$relative = $minutes.' minute'.(((int)$minutes === 1) ? '' : 's').' ago';</li> <li>} else {</li> <li>$hours = ceil($diff/3600);</li> <li>$relative = 'about '.$hours.' hour'.(((int)$hours === 1) ? '' : 's').' ago';</li> <li>}</li> <li>}</li> <li> <li>return $relative;</li> <li>}</li> </ol></div> <em onclick="copycode($('code_I2G'));">复制代码</em> </div> </td></tr></table> <div id="comment_19262" class="cm"> </div> <div id="post_rate_div_19262"></div> <br><br>