summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-23 14:55:24 -0500
committerpommicket <pommicket@gmail.com>2022-12-23 14:55:24 -0500
commit214dae3a7b58077436ffd173ae9fe8f2a6d9b97b (patch)
tree3fda7c1f935eff6ce9e9f647e148296af725e819 /time.c
parentdbab768e4d0be378e65399f32f26edb4756533ce (diff)
wait before showing "Loading..." for autocomplete
Diffstat (limited to 'time.c')
-rw-r--r--time.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/time.c b/time.c
index 57ec9dc..7e82f0d 100644
--- a/time.c
+++ b/time.c
@@ -38,7 +38,12 @@ static struct timespec timespec_max(struct timespec a, struct timespec b) {
static double timespec_to_seconds(struct timespec ts) {
return (double)ts.tv_sec
- + (double)ts.tv_nsec * 0.000000001;
+ + (double)ts.tv_nsec * 1e-9;
+}
+
+static double timespec_sub(struct timespec a, struct timespec b) {
+ return (double)(a.tv_sec - b.tv_sec)
+ + (double)(a.tv_nsec - b.tv_nsec) * 1e-9;
}
static struct timespec time_get(void) {