1 #include <lunaix/clock.h>
2 #include <lunaix/device.h>
3 #include <lunaix/fs/twifs.h>
4 #include <lunaix/spike.h>
6 #include <klibc/string.h>
9 __clock_read_systime(struct twimap* map)
11 ticks_t sys_time = clock_systime();
12 twimap_printf(map, "%u", sys_time);
16 __clock_read_datetime(struct twimap* map)
21 "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
22 dt.year, dt.month, dt.day,
23 dt.hour, dt.minute, dt.second);
27 __clock_read_unix(struct twimap* map)
29 twimap_printf(map, "%u", clock_unixtime());
35 struct twifs_node* root = twifs_dir_node(NULL, "clock");
38 map = twifs_mapping(root, NULL, "systime");
39 map->read = __clock_read_systime;
41 map = twifs_mapping(root, NULL, "unix");
42 map->read = __clock_read_unix;
44 map = twifs_mapping(root, NULL, "datetime");
45 map->read = __clock_read_datetime;
47 EXPORT_TWIFS_PLUGIN(sys_clock, clock_build_mapping);
54 return datetime_tounix(&dt);
64 ticks_t t = hwtimer_current_systicks();
65 ticks_t tu = systimer->running_freq / 1000;
75 clock_walltime(datetime_t* datetime)
77 sysrtc->ops->get_walltime(sysrtc, datetime);