mirror of https://github.com/MidnightCommander/mc
Use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
31008bcc8e
commit
4e8b00f003
|
@ -815,7 +815,7 @@ xmouse_get_event (Gpm_Event * ev, gboolean extended)
|
|||
else
|
||||
{
|
||||
ev->type = GPM_UP | (GPM_SINGLE << clicks);
|
||||
tv1 = g_get_real_time ();
|
||||
tv1 = g_get_monotonic_time ();
|
||||
}
|
||||
ev->buttons = 0;
|
||||
last_btn = 0;
|
||||
|
@ -839,7 +839,7 @@ xmouse_get_event (Gpm_Event * ev, gboolean extended)
|
|||
else
|
||||
ev->type = GPM_DOWN;
|
||||
|
||||
tv2 = g_get_real_time ();
|
||||
tv2 = g_get_monotonic_time ();
|
||||
if (tv1 != 0 && tv2 - tv1 < (gint64) double_click_speed * MC_USEC_PER_MSEC)
|
||||
{
|
||||
clicks++;
|
||||
|
@ -1791,7 +1791,7 @@ get_key_code (int no_delay)
|
|||
if (c == -1)
|
||||
{
|
||||
if (this == NULL || parent == NULL || parent->action != MCKEY_ESCAPE || !old_esc_mode ||
|
||||
esc_time == -1 || g_get_real_time () < esc_time + old_esc_mode_timeout)
|
||||
esc_time == -1 || g_get_monotonic_time () < esc_time + old_esc_mode_timeout)
|
||||
return -1;
|
||||
|
||||
this = NULL;
|
||||
|
@ -1855,7 +1855,7 @@ get_key_code (int no_delay)
|
|||
{
|
||||
if (no_delay != 0)
|
||||
{
|
||||
esc_time = g_get_real_time ();
|
||||
esc_time = g_get_monotonic_time ();
|
||||
goto nodelay_try_again;
|
||||
}
|
||||
|
||||
|
@ -2166,7 +2166,7 @@ learn_key (void)
|
|||
c = tty_lowlevel_getch (); /* Sanity check, should be unnecessary */
|
||||
learn_store_key (buffer, &p, c);
|
||||
|
||||
end_time = g_get_real_time () + LEARN_TIMEOUT * MC_USEC_PER_MSEC;
|
||||
end_time = g_get_monotonic_time () + LEARN_TIMEOUT * MC_USEC_PER_MSEC;
|
||||
|
||||
tty_nodelay (TRUE);
|
||||
while (TRUE)
|
||||
|
@ -2176,7 +2176,7 @@ learn_key (void)
|
|||
gint64 time_out;
|
||||
struct timeval tv;
|
||||
|
||||
time_out = end_time - g_get_real_time ();
|
||||
time_out = end_time - g_get_monotonic_time ();
|
||||
if (time_out <= 0)
|
||||
break;
|
||||
|
||||
|
|
|
@ -1521,7 +1521,7 @@ mc_time_elapsed (gint64 * timestamp, gint64 delay)
|
|||
{
|
||||
gint64 now;
|
||||
|
||||
now = g_get_real_time ();
|
||||
now = g_get_monotonic_time ();
|
||||
|
||||
if (now >= *timestamp && now < *timestamp + delay)
|
||||
return FALSE;
|
||||
|
|
|
@ -870,7 +870,7 @@ vfs_s_dir_uptodate (struct vfs_class *me, struct vfs_s_inode *ino)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tim = g_get_real_time ();
|
||||
tim = g_get_monotonic_time ();
|
||||
|
||||
return (tim < ino->timestamp);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ vfs_addstamp (struct vfs_class *v, vfsid id)
|
|||
stamp = g_new (struct vfs_stamping, 1);
|
||||
stamp->v = v;
|
||||
stamp->id = id;
|
||||
stamp->time = g_get_real_time ();
|
||||
stamp->time = g_get_monotonic_time ();
|
||||
|
||||
stamps = g_slist_append (stamps, stamp);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ vfs_stamp (struct vfs_class *v, vfsid id)
|
|||
stamp = g_slist_find_custom (stamps, &what, vfs_stamp_compare);
|
||||
if (stamp != NULL && stamp->data != NULL)
|
||||
{
|
||||
VFS_STAMPING (stamp->data)->time = g_get_real_time ();
|
||||
VFS_STAMPING (stamp->data)->time = g_get_monotonic_time ();
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ vfs_expire (gboolean now)
|
|||
return;
|
||||
locked = TRUE;
|
||||
|
||||
curr_time = g_get_real_time ();
|
||||
curr_time = g_get_monotonic_time ();
|
||||
exp_time = curr_time - vfs_timeout * G_USEC_PER_SEC;
|
||||
|
||||
if (now)
|
||||
|
|
|
@ -587,7 +587,7 @@ status_msg_init (status_msg_t * sm, const char *title, double delay, status_msg_
|
|||
/* repaint screen to remove previous finished dialog */
|
||||
mc_refresh ();
|
||||
|
||||
start = g_get_real_time ();
|
||||
start = g_get_monotonic_time ();
|
||||
|
||||
sm->dlg = dlg_create (TRUE, 0, 0, 7, MIN (MAX (40, COLS / 2), COLS), WPOS_CENTER, FALSE,
|
||||
dialog_colors, NULL, NULL, NULL, title);
|
||||
|
|
|
@ -817,7 +817,7 @@ progress_update_one (file_op_total_context_t * tctx, file_op_context_t * ctx, of
|
|||
tctx->progress_count++;
|
||||
tctx->progress_bytes += (uintmax_t) add;
|
||||
|
||||
tv_current = g_get_real_time ();
|
||||
tv_current = g_get_monotonic_time ();
|
||||
|
||||
if (tv_start < 0)
|
||||
tv_start = tv_current;
|
||||
|
@ -2388,7 +2388,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
}
|
||||
}
|
||||
|
||||
tv_transfer_start = g_get_real_time ();
|
||||
tv_transfer_start = g_get_monotonic_time ();
|
||||
|
||||
while ((src_desc = mc_open (src_vpath, O_RDONLY | O_LINEAR)) < 0 && !ctx->skip_all)
|
||||
{
|
||||
|
@ -2570,7 +2570,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
if (n_read == 0)
|
||||
break;
|
||||
|
||||
tv_current = g_get_real_time ();
|
||||
tv_current = g_get_monotonic_time ();
|
||||
|
||||
if (n_read > 0)
|
||||
{
|
||||
|
@ -3270,7 +3270,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
|||
}
|
||||
|
||||
tctx = file_op_total_context_new ();
|
||||
tctx->transfer_start = g_get_real_time ();
|
||||
tctx->transfer_start = g_get_monotonic_time ();
|
||||
|
||||
#ifdef ENABLE_BACKGROUND
|
||||
/* Did the user select to do a background operation? */
|
||||
|
|
|
@ -1060,7 +1060,7 @@ file_progress_show_total (file_op_total_context_t * tctx, file_op_context_t * ct
|
|||
gint64 tv_current;
|
||||
char buffer4[BUF_TINY];
|
||||
|
||||
tv_current = g_get_real_time ();
|
||||
tv_current = g_get_monotonic_time ();
|
||||
file_frmt_time (buffer2, (tv_current - tctx->transfer_start) / G_USEC_PER_SEC);
|
||||
|
||||
if (ctx->progress_totals_computed)
|
||||
|
|
|
@ -765,7 +765,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||
|
||||
vfs_print_message (_("fish: Reading directory %s..."), remote_path);
|
||||
|
||||
dir->timestamp = g_get_real_time () + fish_directory_timeout * G_USEC_PER_SEC;
|
||||
dir->timestamp = g_get_monotonic_time () + fish_directory_timeout * G_USEC_PER_SEC;
|
||||
|
||||
quoted_path = strutils_shell_escape (remote_path);
|
||||
(void) fish_command_v (me, super, NONE, FISH_SUPER (super)->scr_ls, "FISH_FILENAME=%s;\n",
|
||||
|
|
|
@ -1493,14 +1493,14 @@ ftpfs_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
|
|||
gint64 start_tim;
|
||||
char buf[BUF_8K];
|
||||
|
||||
start_tim = g_get_real_time ();
|
||||
start_tim = g_get_monotonic_time ();
|
||||
|
||||
/* flush the remaining data */
|
||||
while (read (dsock, buf, sizeof (buf)) > 0)
|
||||
{
|
||||
gint64 tim;
|
||||
|
||||
tim = g_get_real_time ();
|
||||
tim = g_get_monotonic_time ();
|
||||
|
||||
if (tim > start_tim + ABORT_TIMEOUT)
|
||||
{
|
||||
|
@ -1752,7 +1752,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
|
|||
return (-1);
|
||||
}
|
||||
|
||||
dir->timestamp = g_get_real_time () + ftpfs_directory_timeout * G_USEC_PER_SEC;
|
||||
dir->timestamp = g_get_monotonic_time () + ftpfs_directory_timeout * G_USEC_PER_SEC;
|
||||
|
||||
if (ftp_super->strict == RFC_STRICT)
|
||||
sock = ftpfs_open_data_connection (me, super, "LIST", 0, TYPE_ASCII, 0);
|
||||
|
|
Loading…
Reference in New Issue