summaryrefslogtreecommitdiff
path: root/test/snippets/syscall_clock_gettime.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/snippets/syscall_clock_gettime.c')
-rw-r--r--test/snippets/syscall_clock_gettime.c8
1 files changed, 8 insertions, 0 deletions
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);
+