aboutsummaryrefslogtreecommitdiff
path: root/support/xtime.h
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2021-01-18 16:53:26 +0100
committerLukasz Majewski <lukma@denx.de>2021-03-08 22:41:28 +0100
commita1565550075255370f8e6c88dc9c4ad3fd7281ab (patch)
treee9e1f2ce1d50cca15135faea0aa9a7f20fc7e33a /support/xtime.h
parent496e36f2251f28961ce269548b5f3adb6546ef01 (diff)
downloadglibc-a1565550075255370f8e6c88dc9c4ad3fd7281ab.zip
glibc-a1565550075255370f8e6c88dc9c4ad3fd7281ab.tar.gz
glibc-a1565550075255370f8e6c88dc9c4ad3fd7281ab.tar.bz2
support: Provide xclock_settime test helper function
The xclock_settime is a wrapper function on the clock_settime syscall to be used in the test code. It checks if the GLIBC_TEST_ALLOW_TIME_SETTING env variable is defined in the environment in which test is executed. If it is not - the test ends as unsupported. Otherwise, the clock-settime is executed and return value is assessed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'support/xtime.h')
-rw-r--r--support/xtime.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/support/xtime.h b/support/xtime.h
index 2482837..b4ac3b5 100644
--- a/support/xtime.h
+++ b/support/xtime.h
@@ -23,10 +23,15 @@
__BEGIN_DECLS
+/* Name of the env variable, which indicates if it is possible to
+ adjust time on target machine. */
+#define SETTIME_ENV_NAME "GLIBC_TEST_ALLOW_TIME_SETTING"
+
/* The following functions call the corresponding libc functions and
terminate the process on error. */
void xclock_gettime (clockid_t clock, struct timespec *ts);
+void xclock_settime (clockid_t clock, const struct timespec *ts);
/* This helper can often simplify tests by avoiding an explicit
variable declaration or allowing that declaration to be const. */