summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/timer.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/include/timer.h b/src/include/timer.h
index aa5746dbdc..691d6fbab5 100644
--- a/src/include/timer.h
+++ b/src/include/timer.h
@@ -130,7 +130,11 @@ struct stopwatch {
static inline void stopwatch_init(struct stopwatch *sw)
{
- timer_monotonic_get(&sw->start);
+ if (IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER))
+ timer_monotonic_get(&sw->start);
+ else
+ sw->start.microseconds = 0;
+
sw->current = sw->expires = sw->start;
}
@@ -150,7 +154,10 @@ static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
*/
static inline void stopwatch_tick(struct stopwatch *sw)
{
- timer_monotonic_get(&sw->current);
+ if (IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER))
+ timer_monotonic_get(&sw->current);
+ else
+ sw->current.microseconds = 0;
}
/*