diff options
author | Aleksander Machniak <machniak@kolabsys.com> | 2015-03-10 10:17:54 (GMT) |
---|---|---|
committer | Aleksander Machniak <machniak@kolabsys.com> | 2015-03-10 10:17:54 (GMT) |
commit | 74413c0812a9cb25ee18e5c0ad709b2168d03cb3 (patch) | |
tree | 05c056315393cb2b9c327bc34e554e3475b5e337 | |
parent | c9ce8725de0241f58c50f39c68ec52bb1831de0a (diff) | |
download | kolab-chwala-74413c0812a9cb25ee18e5c0ad709b2168d03cb3.tar.gz |
Fix possible division by zero
-rw-r--r-- | lib/file_api.php | 2 |
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) |