rtc: document current interface

Issue #1148
This commit is contained in:
Alexander Boettcher 2014-05-23 09:48:56 +02:00 committed by Christian Helmuth
parent 615830e107
commit 8ef8e8ede9
3 changed files with 8 additions and 3 deletions

View File

@ -25,6 +25,9 @@ namespace Rtc {
{
static const char *service_name() { return "Rtc"; }
/**
* Get microseconds elapsed since 1.1.1970 UTC.
*/
virtual Genode::uint64_t get_current_time() = 0;
GENODE_RPC(Rpc_get_current_time, Genode::uint64_t, get_current_time);

View File

@ -214,7 +214,8 @@ static uint64_t get_rtc_time(void)
PDBG("Date:%02d.%02d.%04d Time:%02d:%02d:%02d\n", day, mon, year, hour, min, sec);
return mktime(day, mon, year, hour, min, sec) * 1000000UL;
/* return microseconds */
return mktime(day, mon, year, hour, min, sec) * 1000000ULL;
}

View File

@ -1121,9 +1121,10 @@ class Machine : public StaticReceiver<Machine>
return true;
}
}
msg.wallclocktime = _rtc->get_current_time();
/* get_current_time is in microseconds */
msg.wallclocktime = _rtc->get_current_time() / 1000000U * MessageTime::FREQUENCY;
Logging::printf("Got time %llx\n", msg.wallclocktime);
msg.timestamp = _unsynchronized_motherboard.clock()->clock(1000000U);
msg.timestamp = _unsynchronized_motherboard.clock()->clock(MessageTime::FREQUENCY);
*Genode::Thread_base::myself()->utcb() = utcb_backup;