webui: last block found fix for none

This commit is contained in:
Jethro Grassie 2018-08-15 10:18:32 -04:00
parent ce734bac92
commit 99db5072b1
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
1 changed files with 3 additions and 1 deletions

View File

@ -103,7 +103,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
time_t now = time(NULL);
double diff = difftime(now, context->pool_stats->last_block_found);
if (diff < 60)
if (context->pool_stats->last_block_found == 0)
snprintf(temp, TAG_MAX, "None yet");
else if (diff < 60)
snprintf(temp, TAG_MAX, "%d seconds ago", (int) diff);
else if (diff < 3600)
snprintf(temp, TAG_MAX, "%d minutes ago", (int) diff / 60);