first real_time_clock impl

todo : setup_rtc_area should be called on startup


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9810 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2004-11-06 17:34:39 +00:00
parent 929bab19c4
commit dc80059933

View File

@ -7,11 +7,35 @@
#include <OS.h>
#include "syscalls.h"
static area_id sCloneRtcArea;
static volatile bigtime_t *sBootTime = NULL;
status_t
setup_rtc_area()
{
area_id rtcArea = find_area("rtc_region");
if (rtcArea < 0) {
printf("setup_rtc_area: error finding rtc_region %s\n",
strerror(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;
}
return B_OK;
}
uint32
real_time_clock(void)
{
// ToDo: real_time_clock()
if (!sBootTime)
setup_rtc_area();
//return (*sBootTime + system_time()) / 1000000;
return 0;
}
@ -26,7 +50,9 @@ set_real_time_clock(uint32 secs)
bigtime_t
real_time_clock_usecs(void)
{
// ToDo: real_time_clock_usecs()
if (!sBootTime)
setup_rtc_area();
//return *sBootTime + system_time();
return 0;
}