X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/2236410f4582ab45ae8c384dd6eeeef5d10aab15..35a7d633d3f16c1e0539af6ca5d8e7482926cd93:/lunaix-os/kernel/time/clock.c?ds=sidebyside diff --git a/lunaix-os/kernel/time/clock.c b/lunaix-os/kernel/time/clock.c index 2bf61d4..a5b9dd8 100644 --- a/lunaix-os/kernel/time/clock.c +++ b/lunaix-os/kernel/time/clock.c @@ -19,12 +19,8 @@ __clock_read_datetime(struct twimap* map) clock_walltime(&dt); twimap_printf(map, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d", - dt.year, - dt.month, - dt.day, - dt.hour, - dt.minute, - dt.second); + dt.year, dt.month, dt.day, + dt.hour, dt.minute, dt.second); } void @@ -67,26 +63,16 @@ clock_systime() ticks_t t = hwtimer_current_systicks(); ticks_t tu = systimer->running_freq / 1000; - return t / (tu + 1); -} -void -clock_walltime(datetime_t* datetime) -{ - sysrtc->get_walltime(sysrtc, datetime); + if (unlikely(!tu)) { + return t; + } + + return t / (tu); } void -clock_init() +clock_walltime(datetime_t* datetime) { - int idx = 0; - struct device_def* pos; - foreach_exported_device_of(load_timedev, idx, pos) - { - if (pos->class.device != DEV_RTC) { - continue; - } - - pos->init(pos); - } + sysrtc->ops->get_walltime(sysrtc, datetime); } \ No newline at end of file