a little math
| From: | Sebe | Date: | Fri, 20 Apr 2007 08:55:12 +0000 |
| Subject: | a little math | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-253324@lists.php.net to get a copy of this message | ||
maybe someone can figure why sometimes i get negative values for seconds..
$job['finished'] and $job['finished'] are both unix timestamp.
i subtract both to get how many seconds some thing took.. well you should be able to read the rest. sometimes it works fine but other times i get negative seconds.
$job['run_time'] = ($job['finished'] - $job['started']);
$minutes = number_format($job['run_time'] / 60, 0, '', '');
// seconds left after calculating minutes
$seconds = (($job['run_time']- 60) * $minutes);
$job['runtime'] = $minutes . ' mins ' . $seconds . ' secs';