2 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU Lesser General Public License 2.1.
7 * Please see the COPYING-LGPL-2.1 file for details.
13 #include <l4/re/env.h>
14 #include <l4/sys/kip.h>
18 typedef int Get_clock(const struct timespec *);
19 extern uint64_t __libc_l4_rt_clock_offset;
21 static int rt_clock_settime(const struct timespec *tp)
25 clock = tp->tv_sec * 1000000 + tp->tv_nsec / 1000;
26 __libc_l4_rt_clock_offset = clock - l4re_kip()->clock;
30 Get_clock *__libc_l4_settime[4] =
32 [CLOCK_REALTIME] = rt_clock_settime,
35 int clock_settime(clockid_t clk_id, const struct timespec *tp)
37 if (clk_id >= NCLOCKS || !__libc_l4_settime[clk_id])
43 return __libc_l4_settime[clk_id](tp);