aboutsummaryrefslogtreecommitdiff
path: root/jim.h
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2022-12-01 10:13:57 +1000
committerSteve Bennett <steveb@workware.net.au>2023-02-13 10:44:10 +1000
commita5ea6b096e9e9f9913ad860a847e3757580dd9e4 (patch)
treec3e317177151e3ad83e996ee198b28aff4765b03 /jim.h
parent4b26f0ec1fa38bcfc8b2bd500a9bef10372bb140 (diff)
downloadjimtcl-a5ea6b096e9e9f9913ad860a847e3757580dd9e4.zip
jimtcl-a5ea6b096e9e9f9913ad860a847e3757580dd9e4.tar.gz
jimtcl-a5ea6b096e9e9f9913ad860a847e3757580dd9e4.tar.bz2
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>
Diffstat (limited to 'jim.h')
-rw-r--r--jim.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/jim.h b/jim.h
index 07dfbeb..4162e5e 100644
--- a/jim.h
+++ b/jim.h
@@ -665,6 +665,16 @@ JIM_EXPORT char *Jim_StrDupLen(const char *s, int l);
JIM_EXPORT char **Jim_GetEnviron(void);
JIM_EXPORT void Jim_SetEnviron(char **env);
JIM_EXPORT int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unlink_file);
+#ifndef CLOCK_REALTIME
+# define CLOCK_REALTIME 0
+#endif
+#ifndef CLOCK_MONOTONIC
+# define CLOCK_MONOTONIC 1
+#endif
+#ifndef CLOCK_MONOTONIC_RAW
+# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
+#endif
+JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
/* evaluation */
JIM_EXPORT int Jim_Eval(Jim_Interp *interp, const char *script);