tests: timer_api: Fix duplicate timestamp update.
Remove duplicate "tdata.timestamp" update in duration_expire; this value is already updated by k_uptime_delta. Besides simply removing duplicate value update, this commit also addresses the intermittent assertion failure that is caused by updating "tdata.timestamp" at a later time than the actual execution of the k_uptime_delta function. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
85afd0f797
commit
b3d6ac2e37
1 changed files with 4 additions and 4 deletions
|
@ -55,15 +55,15 @@ static void init_timer_data(void)
|
||||||
static void duration_expire(struct k_timer *timer)
|
static void duration_expire(struct k_timer *timer)
|
||||||
{
|
{
|
||||||
/** TESTPOINT: expire function */
|
/** TESTPOINT: expire function */
|
||||||
|
s64_t interval = k_uptime_delta(&tdata.timestamp);
|
||||||
|
|
||||||
tdata.expire_cnt++;
|
tdata.expire_cnt++;
|
||||||
if (tdata.expire_cnt == 1) {
|
if (tdata.expire_cnt == 1) {
|
||||||
TIMER_ASSERT(k_uptime_delta(&tdata.timestamp) >= DURATION,
|
TIMER_ASSERT(interval >= DURATION, timer);
|
||||||
timer);
|
|
||||||
} else {
|
} else {
|
||||||
TIMER_ASSERT(k_uptime_delta(&tdata.timestamp) >= PERIOD, timer);
|
TIMER_ASSERT(interval >= PERIOD, timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
tdata.timestamp = k_uptime_get();
|
|
||||||
if (tdata.expire_cnt >= EXPIRE_TIMES) {
|
if (tdata.expire_cnt >= EXPIRE_TIMES) {
|
||||||
k_timer_stop(timer);
|
k_timer_stop(timer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue