From ca6e6e8d165b102ddd44b992d0980f9db92cd791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 7 Nov 2004 01:19:27 +0000 Subject: [PATCH] removed unuseful clone_area This is a temporary solution, until moving to a global kernel export data struct git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9819 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/os/time.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/kernel/libroot/os/time.c b/src/kernel/libroot/os/time.c index 500c5af4b0..8a5d21abcd 100644 --- a/src/kernel/libroot/os/time.c +++ b/src/kernel/libroot/os/time.c @@ -5,9 +5,9 @@ #include +#include #include "syscalls.h" -static area_id sCloneRtcArea; static volatile bigtime_t *sBootTime = NULL; @@ -15,17 +15,21 @@ status_t setup_rtc_area() { area_id rtcArea = find_area("rtc_region"); + area_info info; + status_t err; + if (rtcArea < 0) { printf("setup_rtc_area: error finding rtc_region %s\n", strerror(rtcArea)); + return rtcArea; } - sCloneRtcArea = clone_area("cloned_rtc_region", (void**)&sBootTime, - B_ANY_ADDRESS, B_READ_AREA, rtcArea); - if (sCloneRtcArea < 0) { - printf("setup_rtc_area: error cloning rtc_region\n"); - return sCloneRtcArea; + + err = get_area_info(rtcArea, &info); + if (err < B_OK) { + printf("setup_rtc_area: error getting rtc_region info\n"); + return err; } - + sBootTime = (bigtime_t *)info.address; return B_OK; } @@ -33,10 +37,9 @@ setup_rtc_area() uint32 real_time_clock(void) { - if (!sBootTime) - setup_rtc_area(); - //return (*sBootTime + system_time()) / 1000000; - return 0; + if (!sBootTime && (setup_rtc_area()!=B_OK)) + return 0; + return (*sBootTime + system_time()) / 1000000; } @@ -50,10 +53,9 @@ set_real_time_clock(uint32 secs) bigtime_t real_time_clock_usecs(void) { - if (!sBootTime) - setup_rtc_area(); - //return *sBootTime + system_time(); - return 0; + if (!sBootTime && (setup_rtc_area() != B_OK)) + return 0; + return *sBootTime + system_time(); }