diff --git a/abstract-machine/am/src/platform/nemu/ioe/timer.c b/abstract-machine/am/src/platform/nemu/ioe/timer.c index a22c539..a566162 100644 --- a/abstract-machine/am/src/platform/nemu/ioe/timer.c +++ b/abstract-machine/am/src/platform/nemu/ioe/timer.c @@ -17,7 +17,10 @@ void __am_timer_init() { } void __am_timer_uptime(AM_TIMER_UPTIME_T *uptime) { - (*(volatile AM_TIMER_UPTIME_T *)uptime).us = GET_TIME() - __timer_start; + volatile uint32_t lower_timer = inl(RTC_ADDR); + volatile uint32_t high_timer = inl(RTC_ADDR + 4); + volatile uint64_t timer = lower_timer + (((uint64_t) high_timer) << 32); + (*(volatile AM_TIMER_UPTIME_T *)uptime).us = timer - __timer_start; PNT_BITS(uptime->us); }