Use weak __thread declarations in parlib-compat (XCC)
[akaros.git] / tools / compilers / gcc-glibc / glibc-2.19-akaros / sysdeps / akaros / clock_gettime.c
1 /* Copyright (c) 2016 Google Inc.
2  * Barret Rhoden <brho@cs.berkeley.edu>
3  * See LICENSE for details.
4  *
5  * Implementation of glibc's clock_gettime
6  *
7  * TODO:
8  * - consider supporting more clocks.
9  */
10
11 #include <time.h>
12 #include <sys/time.h>
13 #include <parlib/timing.h>
14
15 int __clock_gettime(clockid_t clk_id, struct timespec *tp)
16 {
17         uint64_t epoch_ns = epoch_nsec();
18
19         tp->tv_sec = epoch_ns / 1000000000;
20         tp->tv_nsec = epoch_ns % 1000000000;
21         return 0;
22 }
23 weak_alias(__clock_gettime, clock_gettime)
24 libc_hidden_def(__clock_gettime)