2 * \file rtc/server/src/ux.c
3 * \brief Get current time
6 * \author Adam Lackorzynski <adam@os.inf.tu-dresden.de> */
9 * (c) 2003-2009 Author(s)
10 * economic rights: Technische Universität Dresden (Germany)
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU General Public License 2.
14 * Please see the COPYING-GPL-2 file for details.
17 #include <l4/lxfuxlibc/lxfuxlc.h>
19 #include <l4/sys/thread.h>
20 #include <l4/re/env.h>
21 #include <l4/util/rdtsc.h>
22 #include <l4/util/kip.h>
29 static void printit(void)
31 time_t t = lx_time(NULL);
36 printf("Date:%02d.%02d.%04d Time:%02d:%02d:%02d\n",
37 r->tm_mday, r->tm_mon + 1, r->tm_year + 1900,
38 r->tm_hour, r->tm_min, r->tm_sec);
42 get_base_time_ux(void)
44 l4_uint32_t current_s, current_ns;
46 l4_tsc_to_s_and_ns(l4_rdtsc(), ¤t_s, ¤t_ns);
47 system_time_offs_rel_1970 = lx_time(NULL) - current_s;
54 get_base_time_func_t init_ux(void)
56 if (l4util_kip_kernel_is_ux(l4re_kip()))
58 l4_thread_control_start();
59 l4_thread_control_ux_host_syscall(1);
60 l4_thread_control_commit(l4re_env()->main_thread);
61 return get_base_time_ux;