]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/rtc/lib/libc_backend/gettime.c
update
[l4.git] / l4 / pkg / rtc / lib / libc_backend / gettime.c
1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9
10 #include <l4/sys/types.h>
11 #include <l4/libc_backends/clk.h>
12 #include "gettime.h"
13
14 int libc_backend_rt_clock_gettime(struct timespec *tp)
15 {
16   l4_uint32_t s, ns;
17
18   libc_backend_rtc_get_s_and_ns(&s, &ns);
19
20   tp->tv_sec  = s + l4rtc_offset;
21   tp->tv_nsec = ns;
22
23   return 0;
24 }