CVS: phpweather/output pw_text.php,1.17,1.18
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2003-05-09 01:02:52
|
Update of /cvsroot/phpweather/phpweather/output In directory sc8-pr-cvs1:/tmp/cvs-serv16678/output Modified Files: pw_text.php Log Message: Instead of rounding the $minutes_old and $hours, we truncate. The old code would make a report that is 6000 seconds old look like it was 2 hours and 40 minutes old because the 1.66 hours were rounded upward to 2 hours. Thanks goes to Jim Whitehead for pointing this out and fixing it. Index: pw_text.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_text.php,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- pw_text.php 5 Mar 2003 19:53:24 -0000 1.17 +++ pw_text.php 8 May 2003 19:42:36 -0000 1.18 @@ -635,9 +635,9 @@ } function print_pretty_time($time) { - $minutes_old = round((time() - $time)/60); - if ($minutes_old > 60) { - $hours = round((time() - $time)/3600); + $minutes_old = (int) ((time() - $time)/60); + if ($minutes_old >= 60) { + $hours = (int) ((time() - $time)/3600); $minutes = $minutes_old % 60; if ($minutes < 1) { $minutes = ''; |