Skip to content

Commit 055c7db

Browse files
committed
progress dialog: Fix remaining time
1 parent 6beb421 commit 055c7db

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

rpcs3/Emu/system_progress.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ void progress_dialog_server::operator()()
160160

161161
u32 ftotal = 0;
162162
u32 fdone = 0;
163-
u32 fknown_bits = 0;
164-
u32 ftotal_bits = 0;
163+
u64 fknown_bits = 0;
164+
u64 ftotal_bits = 0;
165165
u32 ptotal = 0;
166166
u32 pdone = 0;
167167
const char* text1 = nullptr;
@@ -236,9 +236,10 @@ void progress_dialog_server::operator()()
236236
const u64 passed = (get_system_time() - start_time);
237237
const u64 seconds_passed = passed / 1'000'000;
238238
const u64 seconds_total = (passed / 1'000'000 * 100 / value);
239-
const u64 seconds = seconds_total % 60;
240-
const u64 minutes = (seconds_total / 60) % 60;
241-
const u64 hours = (seconds_total / 3600);
239+
const u64 seconds_remaining = seconds_total - seconds_passed;
240+
const u64 seconds = seconds_remaining % 60;
241+
const u64 minutes = (seconds_remaining / 60) % 60;
242+
const u64 hours = (seconds_remaining / 3600);
242243

243244
if (seconds_passed < 4)
244245
{
@@ -252,6 +253,10 @@ void progress_dialog_server::operator()()
252253
{
253254
fmt::append(progr, " (%um remaining)", minutes);
254255
}
256+
else if (minutes == 0)
257+
{
258+
fmt::append(progr, " (%02us remaining)", seconds);
259+
}
255260
else
256261
{
257262
fmt::append(progr, " (%um %02us remaining)", minutes, seconds);

0 commit comments

Comments
 (0)