summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-06-02 11:29:48 +0100
committerThomas Adam <thomas@xteddy.org>2020-06-02 11:29:48 +0100
commit31a51cae1dc420281bd3c51c2f0521668ad4e25d (patch)
tree48699668aa6b89ee41a9960d871e05fa9304309c /tmux.c
parent191a836560f1b1996c4976eb496b27a6d428ba21 (diff)
parentf3931497f8aee291bce132fb106cedb55c5b3fa9 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tmux.c b/tmux.c
index b600702c..b9a676a2 100644
--- a/tmux.c
+++ b/tmux.c
@@ -237,6 +237,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)
{