Skip to content

Commit ace4ca2

Browse files
committed
PGPRO-2407: Time for RUNNING backup now calculated on the fly
1 parent 34cb916 commit ace4ca2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/show.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ show_instance_plain(parray *backup_list, bool show_name)
325325
uint32 widths[SHOW_FIELDS_COUNT];
326326
uint32 widths_sum = 0;
327327
ShowBackendRow *rows;
328+
time_t current_time = time(NULL);
328329

329330
for (i = 0; i < SHOW_FIELDS_COUNT; i++)
330331
widths[i] = strlen(names[i]);
@@ -384,7 +385,11 @@ show_instance_plain(parray *backup_list, bool show_name)
384385
cur++;
385386

386387
/* Time */
387-
if (backup->end_time != (time_t) 0)
388+
if (backup->status == BACKUP_STATUS_RUNNING)
389+
snprintf(row->duration, lengthof(row->duration), "%.*lfs", 0,
390+
difftime(current_time, backup->start_time));
391+
392+
else if (backup->end_time != (time_t) 0)
388393
snprintf(row->duration, lengthof(row->duration), "%.*lfs", 0,
389394
difftime(backup->end_time, backup->start_time));
390395
else

0 commit comments

Comments
 (0)