(file_progress_show_total): add 'tv_current' argument.

Get rid of g_get_monotonic_time() here. If possible, use time value
calculated before.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-09-09 09:03:16 +03:00
parent 6ba3cc68c0
commit d844c6212c
3 changed files with 8 additions and 7 deletions

View File

@ -831,7 +831,7 @@ progress_update_one (file_op_context_t *ctx, off_t add)
if (verbose && ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
{
file_progress_show_count (ctx);
file_progress_show_total (ctx, ctx->progress_bytes, TRUE);
file_progress_show_total (ctx, ctx->progress_bytes, tv_current, TRUE);
}
tv_start = tv_current;
@ -2759,7 +2759,8 @@ copy_file_file (file_op_context_t *ctx, const char *src_path, const char *dst_pa
if (ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
{
file_progress_show_count (ctx);
file_progress_show_total (ctx, ctx->total_progress_bytes, force_update);
file_progress_show_total (ctx, ctx->total_progress_bytes, tv_current,
force_update);
}
mc_refresh ();
@ -3627,7 +3628,8 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
if (ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
{
file_progress_show_count (ctx);
file_progress_show_total (ctx, ctx->progress_bytes, FALSE);
file_progress_show_total (ctx, ctx->progress_bytes, g_get_monotonic_time (),
FALSE);
}
if (operation != OP_DELETE)

View File

@ -1100,7 +1100,8 @@ file_progress_show_count (file_op_context_t *ctx)
/* --------------------------------------------------------------------------------------------- */
void
file_progress_show_total (file_op_context_t *ctx, uintmax_t copied_bytes, gboolean show_summary)
file_progress_show_total (file_op_context_t *ctx, uintmax_t copied_bytes, gint64 tv_current,
gboolean show_summary)
{
char buffer2[BUF_TINY];
char buffer3[BUF_TINY];
@ -1128,10 +1129,8 @@ file_progress_show_total (file_op_context_t *ctx, uintmax_t copied_bytes, gboole
if (ui->time_label != NULL)
{
gint64 tv_current;
char buffer4[BUF_TINY];
tv_current = g_get_monotonic_time ();
file_frmt_time (buffer2, (tv_current - ctx->total_transfer_start) / G_USEC_PER_SEC);
if (ctx->totals_computed)

View File

@ -174,7 +174,7 @@ FileProgressStatus file_progress_check_buttons (file_op_context_t * ctx);
void file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
const char *stalled_msg, gboolean force_update);
void file_progress_show_count (file_op_context_t * ctx);
void file_progress_show_total (file_op_context_t * ctx, uintmax_t copied_bytes,
void file_progress_show_total (file_op_context_t * ctx, uintmax_t copied_bytes, gint64 tv_current,
gboolean show_summary);
void file_progress_show_source (file_op_context_t * ctx, const vfs_path_t * vpath);
void file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * vpath);