summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2015-03-10 10:17:54 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2015-03-10 10:17:54 (GMT)
commit74413c0812a9cb25ee18e5c0ad709b2168d03cb3 (patch)
tree05c056315393cb2b9c327bc34e554e3475b5e337
parentc9ce8725de0241f58c50f39c68ec52bb1831de0a (diff)
downloadkolab-chwala-74413c0812a9cb25ee18e5c0ad709b2168d03cb3.tar.gz
Fix possible division by zero
-rw-r--r--lib/file_api.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/file_api.php b/lib/file_api.php
index a458b8d..62d522f 100644
--- a/lib/file_api.php
+++ b/lib/file_api.php
@@ -295,7 +295,7 @@ class file_api extends file_api_core
if (!empty($status)) {
$status['percent'] = round($status['current']/$status['total']*100);
if ($status['percent'] < 100) {
- $diff = time() - intval($status['start_time']);
+ $diff = max(1, time() - intval($status['start_time']));
// calculate time to end of uploading (in seconds)
$status['eta'] = intval($diff * (100 - $status['percent']) / $status['percent']);
// average speed (bytes per second)