From d83ed63a3149639ea96163a43530bb85f63dde3a Mon Sep 17 00:00:00 2001 From: Filip Jagodzinski Date: Thu, 9 Nov 2017 16:42:55 +0100 Subject: [PATCH] RTOS: SysTimer: Fix update_tick --- rtos/TARGET_CORTEX/SysTimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtos/TARGET_CORTEX/SysTimer.cpp b/rtos/TARGET_CORTEX/SysTimer.cpp index 3f56ac36f7..fc2e06bc36 100644 --- a/rtos/TARGET_CORTEX/SysTimer.cpp +++ b/rtos/TARGET_CORTEX/SysTimer.cpp @@ -78,7 +78,7 @@ uint32_t SysTimer::get_tick() uint32_t SysTimer::update_tick() { - uint64_t new_tick = ticker_read_us(_ticker_data) * OS_TICK_FREQ / 1000000; + uint64_t new_tick = (ticker_read_us(_ticker_data) - _start_time) * OS_TICK_FREQ / 1000000; if (new_tick > _tick) { // Don't update to the current tick. Instead, update to the // previous tick and let the SysTick handler increment it