diff --git a/abstract-machine/am/src/platform/nemu/ioe/timer.c b/abstract-machine/am/src/platform/nemu/ioe/timer.c index 32f5070..4592be6 100644 --- a/abstract-machine/am/src/platform/nemu/ioe/timer.c +++ b/abstract-machine/am/src/platform/nemu/ioe/timer.c @@ -3,11 +3,14 @@ #define GET_TIME() ((uint64_t) (uint32_t)inl(RTC_ADDR) | ((uint64_t) (uint32_t)inl(RTC_ADDR + 4) << 32)) +uint64_t __timer_start; + void __am_timer_init() { + __timer_start = GET_TIME(); } void __am_timer_uptime(AM_TIMER_UPTIME_T *uptime) { - uptime->us = GET_TIME(); + (*(volatile AM_TIMER_UPTIME_T *)uptime).us = GET_TIME() - __timer_start; } void __am_timer_rtc(AM_TIMER_RTC_T *rtc) {