From f3931497f8aee291bce132fb106cedb55c5b3fa9 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 2 Jun 2020 08:17:27 +0000 Subject: Use CLOCK_MONOTONIC for timer measurement and add a timestamp to control mode %output blocks. --- window-copy.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'window-copy.c') diff --git a/window-copy.c b/window-copy.c index cfa91df9..af80186b 100644 --- a/window-copy.c +++ b/window-copy.c @@ -2934,15 +2934,6 @@ window_copy_search(struct window_mode_entry *wme, int direction, int regex) return (found); } -static uint64_t -window_copy_get_time(void) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - return ((tv.tv_sec * 1000ULL) + (tv.tv_usec / 1000ULL)); -} - static int window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp, int regex) @@ -2985,11 +2976,11 @@ window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp, return (0); } } - tstart = window_copy_get_time(); + tstart = get_timer(); start = 0; end = gd->hsize + gd->sy; - stop = window_copy_get_time() + WINDOW_COPY_SEARCH_ALL_TIMEOUT; + stop = get_timer() + WINDOW_COPY_SEARCH_ALL_TIMEOUT; again: free(data->searchmark); @@ -3027,7 +3018,7 @@ again: px++; } - t = window_copy_get_time(); + t = get_timer(); if (t - tstart > WINDOW_COPY_SEARCH_TIMEOUT) { data->timeout = 1; break; -- cgit