switch to struct real_time_data, renamed function and variables
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9881 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b138834ceb
commit
2e080fb4d6
@ -7,29 +7,29 @@
|
||||
#include <OS.h>
|
||||
#include <string.h>
|
||||
#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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user