diff --git a/lib/util.c b/lib/util.c
index ceace41..556f370 100644
a
|
b
|
mc_replace_error (GError ** dest, int code, const char *format, ...) |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | /* --------------------------------------------------------------------------------------------- */ |
| 1454 | |
| 1455 | /** |
| 1456 | * Returns if the given duration has elapsed since the given timestamp, |
| 1457 | * and if it has then updates the timestamp. |
| 1458 | * Returns TRUE if clock skew detected. |
| 1459 | * |
| 1460 | * @param tv the last timestamp, updated if the given time elapsed |
| 1461 | * @param duration amount of time in seconds |
| 1462 | */ |
| 1463 | gboolean |
| 1464 | mc_time_elapsed (double *timestamp, double delay) |
| 1465 | { |
| 1466 | struct timeval tv_now; |
| 1467 | double now; |
| 1468 | |
| 1469 | if (gettimeofday(&tv_now, NULL) != 0) |
| 1470 | return TRUE; |
| 1471 | now = tv_now.tv_sec + tv_now.tv_usec / 1000000.0; |
| 1472 | |
| 1473 | if (now >= *timestamp && now < *timestamp + delay) |
| 1474 | return FALSE; |
| 1475 | |
| 1476 | *timestamp = now; |
| 1477 | return TRUE; |
| 1478 | } |
| 1479 | |
| 1480 | /* --------------------------------------------------------------------------------------------- */ |
diff --git a/lib/util.h b/lib/util.h
index 26ba190..5f29ff5 100644
a
|
b
|
char *mc_build_filenamev (const char *first_element, va_list args); |
207 | 207 | void mc_propagate_error (GError ** dest, int code, const char *format, ...); |
208 | 208 | void mc_replace_error (GError ** dest, int code, const char *format, ...); |
209 | 209 | |
| 210 | gboolean mc_time_elapsed (double *timestamp, double delay); |
| 211 | |
210 | 212 | /*** inline functions **************************************************/ |
211 | 213 | |
212 | 214 | static inline gboolean |
diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c
index 058db93..efab61e 100644
a
|
b
|
status_msg_init (status_msg_t * sm, const char *title, double delay, status_msg_ |
575 | 575 | { |
576 | 576 | sm->dlg = dlg_create (TRUE, 0, 0, 7, min (max (40, COLS / 2), COLS), dialog_colors, |
577 | 577 | NULL, NULL, NULL, title, DLG_CENTER); |
578 | | sm->delay = delay * G_USEC_PER_SEC; |
| 578 | sm->delay = status_msg_delay_threshold + 1; // delay * G_USEC_PER_SEC; |
579 | 579 | sm->block = FALSE; |
580 | 580 | |
581 | 581 | sm->init = init_cb; |
diff --git a/src/filemanager/file.c b/src/filemanager/file.c
index caf375b..f8cdf29 100644
a
|
b
|
do_compute_dir_size (const vfs_path_t * dirname_vpath, dirsize_status_msg_t * ds |
529 | 529 | DIR *dir; |
530 | 530 | struct dirent *dirent; |
531 | 531 | FileProgressStatus ret = FILE_CONT; |
| 532 | static double timestamp = 0; |
532 | 533 | |
533 | 534 | if (!compute_symlinks) |
534 | 535 | { |
… |
… |
do_compute_dir_size (const vfs_path_t * dirname_vpath, dirsize_status_msg_t * ds |
568 | 569 | ret = |
569 | 570 | do_compute_dir_size (tmp_vpath, dsm, dir_count, ret_marked, ret_total, |
570 | 571 | compute_symlinks); |
571 | | if (ret == FILE_CONT && sm->update != NULL) |
| 572 | if (ret == FILE_CONT && sm->update != NULL && mc_time_elapsed(×tamp, 0.04 /* 25 FPS */)) |
572 | 573 | { |
573 | 574 | dsm->dirname_vpath = tmp_vpath; |
574 | 575 | dsm->dir_count = *dir_count; |
… |
… |
do_compute_dir_size (const vfs_path_t * dirname_vpath, dirsize_status_msg_t * ds |
582 | 583 | *ret_total += (uintmax_t) s.st_size; |
583 | 584 | |
584 | 585 | update_ui_count++; |
585 | | if ((update_ui_count & 31) == 0) |
| 586 | if ((update_ui_count & 31) == 0 && mc_time_elapsed(×tamp, 0.04 /* 25 FPS */)) |
586 | 587 | { |
587 | 588 | if (sm->update == NULL) |
588 | 589 | ret = FILE_CONT; |