diff options
-rw-r--r-- | test/snippets/include_headers.h | 1 | ||||
-rw-r--r-- | test/snippets/syscall_clock_gettime.c | 8 | ||||
-rw-r--r-- | test/snippets/syscall_clock_gettime.variable | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/test/snippets/include_headers.h b/test/snippets/include_headers.h index 0c1bd85..55cd48f 100644 --- a/test/snippets/include_headers.h +++ b/test/snippets/include_headers.h @@ -5,3 +5,4 @@ #include <sys/syscall.h> #include <string.h> #include <errno.h> +#include <time.h> diff --git a/test/snippets/syscall_clock_gettime.c b/test/snippets/syscall_clock_gettime.c new file mode 100644 index 0000000..21b99ba --- /dev/null +++ b/test/snippets/syscall_clock_gettime.c @@ -0,0 +1,8 @@ +struct timespec ts; +clockid_t ckid = CLOCK_REALTIME; +long ret = syscall(__NR_clock_gettime, ckid, &ts); +if (ret == 0) + printf("[%s] syscall(__NR_gettime, CLOCK_REALTIME[%d], &ts) -> {%lld, %ld}\n", where, ckid, (long long)ts.tv_sec, ts.tv_nsec); +else + printf("[%s] syscall(__NR_gettime, CLOCK_REALTIME[%d], &ts) returned non-zero (%ld)\n", where, ckid, ret); + diff --git a/test/snippets/syscall_clock_gettime.variable b/test/snippets/syscall_clock_gettime.variable new file mode 100644 index 0000000..e89e166 --- /dev/null +++ b/test/snippets/syscall_clock_gettime.variable @@ -0,0 +1 @@ +FAKETIME 2020-01-01 00:00:00 |