From a5ea6b096e9e9f9913ad860a847e3757580dd9e4 Mon Sep 17 00:00:00 2001
From: Steve Bennett <steveb@workware.net.au>
Date: Thu, 1 Dec 2022 10:13:57 +1000
Subject: clock millis, time: now use monotonic raw time if possible

Instead of using all time, these commands now use a monotonically
increasing system timer so that they are not affected by time (e.g. ntp) adjustments.
(But not on Windows since it doesn't work reliably)

Fixes #240

Signed-off-by: Steve Bennett <steveb@workware.net.au>
---
 auto.def | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'auto.def')

diff --git a/auto.def b/auto.def
index 5d751f1..2cd63c5 100644
--- a/auto.def
+++ b/auto.def
@@ -251,7 +251,7 @@ cc-check-functions geteuid mkstemp isatty
 cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist isascii
 cc-check-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes
 cc-check-functions shutdown socketpair link symlink fsync dup umask
-cc-check-functions localtime gmtime strptime clock_gettime
+cc-check-functions localtime gmtime strptime
 if {![cc-check-functions realpath]} {
 	cc-check-functions _fullpath
 }
@@ -534,6 +534,9 @@ if {[have-feature windows]} {
             set buildjimext 0
         }
     }
+} else {
+    # We don't trust any version of clock_gettime on windows
+    cc-check-functions clock_gettime
 }
 if {[have-feature termios.h]} {
     lappend extra_objs jim-tty.o
-- 
cgit v1.1

