From 467e7e5041e891296c2c79523ba0726cb4035b8c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 24 Oct 2023 16:38:17 +0530 Subject: [PATCH] function to convert monotonic_t to microsecs --- kitty/monotonic.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kitty/monotonic.h b/kitty/monotonic.h index db6a4254b..cb91dcb3f 100644 --- a/kitty/monotonic.h +++ b/kitty/monotonic.h @@ -13,6 +13,7 @@ #define MONOTONIC_T_MAX INT64_MAX #define MONOTONIC_T_MIN INT64_MIN #define MONOTONIC_T_1e6 1000000ll +#define MONOTONIC_T_1e3 1000ll #define MONOTONIC_T_1e9 1000000000ll typedef int64_t monotonic_t; @@ -42,6 +43,12 @@ monotonic_t_to_ms(monotonic_t time) { return (int)(time / MONOTONIC_T_1e6); } +static inline int +monotonic_t_to_us(monotonic_t time) { + return (int)(time / MONOTONIC_T_1e3); +} + + static inline double monotonic_t_to_s_double(monotonic_t time) { return ((double)time) / 1e9;