Skip to content

Commit 7a62a41

Browse files
committed
Detailed status: Have first "new" figures reflect "after restoring"
Before this, they just repeated the totals on first call. Closes #5926
1 parent a1e0049 commit 7a62a41

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/status.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ static const char* timeFmt24 = NULL;
5050
static int showcand, last_count;
5151
double (*status_get_progress)(void) = NULL;
5252

53+
/* Detailed status previous values */
54+
static struct status_main prev;
55+
static double prev_time;
56+
5357
clock_t status_get_raw_time(void)
5458
{
5559
#if !HAVE_SYS_TIMES_H
@@ -66,12 +70,17 @@ void status_update_counts(void)
6670
last_count = status.guess_count;
6771
}
6872

73+
static double status_get_timef(void);
74+
6975
void status_init(double (*get_progress)(void), int start)
7076
{
7177
if (start) {
7278
if (!status_restored_time)
7379
memset(&status, 0, sizeof(status));
7480
status.start_time = status_get_raw_time();
81+
82+
prev_time = status_get_timef();
83+
prev = status;
7584
}
7685

7786
status_get_progress = get_progress;
@@ -456,8 +465,6 @@ void status_print(int level)
456465
return;
457466
}
458467

459-
static struct status_main prev;
460-
static double prev_time;
461468
double time = status_get_timef();
462469
double new_time = time - prev_time;
463470
char s_gps[32], s_pps[32], s_crypts_ps[32], s_combs_ps[32];

0 commit comments

Comments
 (0)