diff options
Diffstat (limited to 'usr.bin/tmux/tmux.c')
-rw-r--r-- | usr.bin/tmux/tmux.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 13346c966cf..4a610b4c769 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.201 2020/05/16 16:07:55 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.202 2020/06/02 08:17:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -240,6 +240,20 @@ setblocking(int fd, int state) } } +uint64_t +get_timer(void) +{ + struct timespec ts; + + /* + * We want a timestamp in milliseconds suitable for time measurement, + * so prefer the monotonic clock. + */ + if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + clock_gettime(CLOCK_REALTIME, &ts); + return ((ts.tv_sec * 1000ULL) + (ts.tv_nsec / 1000000ULL)); +} + const char * sig2name(int signo) { |