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:
@@ -7,29 +7,29 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "syscalls.h"
|
#include "syscalls.h"
|
||||||
|
#include "real_time_data.h"
|
||||||
|
|
||||||
static volatile bigtime_t *sBootTime = NULL;
|
static volatile bigtime_t *sBootTime = NULL;
|
||||||
|
|
||||||
|
static status_t
|
||||||
status_t
|
setup_rtc_boottime()
|
||||||
setup_rtc_area()
|
|
||||||
{
|
{
|
||||||
area_id rtcArea = find_area("rtc_region");
|
area_id dataArea = find_area("real time data userland");
|
||||||
area_info info;
|
area_info info;
|
||||||
status_t err;
|
status_t err;
|
||||||
|
|
||||||
if (rtcArea < 0) {
|
if (dataArea < 0) {
|
||||||
printf("setup_rtc_area: error finding rtc_region %s\n",
|
printf("setup_rtc_boottime: error finding real time data area %s\n",
|
||||||
strerror(rtcArea));
|
strerror(dataArea));
|
||||||
return rtcArea;
|
return dataArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_area_info(rtcArea, &info);
|
err = get_area_info(dataArea, &info);
|
||||||
if (err < B_OK) {
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
sBootTime = (bigtime_t *)info.address;
|
sBootTime = &((struct real_time_data *)info.address)->boot_time;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ setup_rtc_area()
|
|||||||
uint32
|
uint32
|
||||||
real_time_clock(void)
|
real_time_clock(void)
|
||||||
{
|
{
|
||||||
if (!sBootTime && (setup_rtc_area()!=B_OK))
|
if (!sBootTime && (setup_rtc_boottime()!=B_OK))
|
||||||
return 0;
|
return 0;
|
||||||
return (*sBootTime + system_time()) / 1000000;
|
return (*sBootTime + system_time()) / 1000000;
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ set_real_time_clock(uint32 secs)
|
|||||||
bigtime_t
|
bigtime_t
|
||||||
real_time_clock_usecs(void)
|
real_time_clock_usecs(void)
|
||||||
{
|
{
|
||||||
if (!sBootTime && (setup_rtc_area() != B_OK))
|
if (!sBootTime && (setup_rtc_boottime() != B_OK))
|
||||||
return 0;
|
return 0;
|
||||||
return *sBootTime + system_time();
|
return *sBootTime + system_time();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user