diff --git a/repos/os/include/rtc_session/rtc_session.h b/repos/os/include/rtc_session/rtc_session.h index 9eeb3d81db..fb5a33a884 100644 --- a/repos/os/include/rtc_session/rtc_session.h +++ b/repos/os/include/rtc_session/rtc_session.h @@ -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); diff --git a/repos/os/src/drivers/rtc/x86/main.cc b/repos/os/src/drivers/rtc/x86/main.cc index f24180c020..d3e02afde3 100644 --- a/repos/os/src/drivers/rtc/x86/main.cc +++ b/repos/os/src/drivers/rtc/x86/main.cc @@ -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; } diff --git a/repos/ports/src/app/seoul/main.cc b/repos/ports/src/app/seoul/main.cc index 05c01916d7..d24c1a1bac 100644 --- a/repos/ports/src/app/seoul/main.cc +++ b/repos/ports/src/app/seoul/main.cc @@ -1121,9 +1121,10 @@ class Machine : public StaticReceiver 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;