diff --git a/src/kernel/libroot/os/time.c b/src/kernel/libroot/os/time.c index 8a5d21abcd..524311d056 100644 --- a/src/kernel/libroot/os/time.c +++ b/src/kernel/libroot/os/time.c @@ -7,29 +7,29 @@ #include #include #include "syscalls.h" +#include "real_time_data.h" static volatile bigtime_t *sBootTime = NULL; - -status_t -setup_rtc_area() +static status_t +setup_rtc_boottime() { - area_id rtcArea = find_area("rtc_region"); + area_id dataArea = find_area("real time data userland"); area_info info; status_t err; - if (rtcArea < 0) { - printf("setup_rtc_area: error finding rtc_region %s\n", - strerror(rtcArea)); - return rtcArea; + if (dataArea < 0) { + printf("setup_rtc_boottime: error finding real time data area %s\n", + strerror(dataArea)); + return dataArea; } - err = get_area_info(rtcArea, &info); + err = get_area_info(dataArea, &info); if (err < B_OK) { - printf("setup_rtc_area: error getting rtc_region info\n"); + printf("setup_rtc_boottime: error getting real time data info\n"); return err; } - sBootTime = (bigtime_t *)info.address; + sBootTime = &((struct real_time_data *)info.address)->boot_time; return B_OK; } @@ -37,7 +37,7 @@ setup_rtc_area() uint32 real_time_clock(void) { - if (!sBootTime && (setup_rtc_area()!=B_OK)) + if (!sBootTime && (setup_rtc_boottime()!=B_OK)) return 0; return (*sBootTime + system_time()) / 1000000; } @@ -53,7 +53,7 @@ set_real_time_clock(uint32 secs) bigtime_t real_time_clock_usecs(void) { - if (!sBootTime && (setup_rtc_area() != B_OK)) + if (!sBootTime && (setup_rtc_boottime() != B_OK)) return 0; return *sBootTime + system_time(); }