mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
Everywhere: Use ElapsedTimer::elapsed_time() for comparisons
Simplify a lot of uses of ElapsedTimer by converting the callers to elapsed_time from elapsed, as the AK::Time returned is better for unit conversions and comparisons against constants.
This commit is contained in:
parent
4afa6e264c
commit
ddf348daeb
8 changed files with 22 additions and 12 deletions
|
@ -141,13 +141,13 @@ void FileOperationProgressWidget::did_error(StringView message)
|
|||
|
||||
DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
|
||||
{
|
||||
int elapsed = m_elapsed_timer.elapsed() / 1000;
|
||||
i64 const elapsed_seconds = m_elapsed_timer.elapsed_time().to_seconds();
|
||||
|
||||
if (bytes_done == 0 || elapsed < 3)
|
||||
if (bytes_done == 0 || elapsed_seconds < 3)
|
||||
return "Estimating...";
|
||||
|
||||
off_t bytes_left = total_byte_count - bytes_done;
|
||||
int seconds_remaining = (bytes_left * elapsed) / bytes_done;
|
||||
int seconds_remaining = (bytes_left * elapsed_seconds) / bytes_done;
|
||||
|
||||
if (seconds_remaining < 30)
|
||||
return DeprecatedString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue