From 16276a4793d49bc6caa37d8c5882af6ff09caec2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 18 May 2015 06:34:54 -0600 Subject: [PATCH] Change the order of some operations to prevent a debug assertion from firing. --- sched/clock/clock_settime.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sched/clock/clock_settime.c b/sched/clock/clock_settime.c index 068626de0be..e9f27f0f6a3 100644 --- a/sched/clock/clock_settime.c +++ b/sched/clock/clock_settime.c @@ -111,17 +111,17 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp) flags = irqsave(); - /* Save the new base time. */ - - g_basetime.tv_sec = tp->tv_sec; - g_basetime.tv_nsec = tp->tv_nsec; - /* Get the elapsed time since power up (in milliseconds). This is a * bias value that we need to use to correct the base time. */ (void)clock_systimespec(&bias); + /* Save the new base time. */ + + g_basetime.tv_sec = tp->tv_sec; + g_basetime.tv_nsec = tp->tv_nsec; + /* Subtract that bias from the basetime so that when the system * timer is again added to the base time, the result is the current * time relative to basetime.