This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

k_uptime_get()

I need to keep track of the time elapsed since boot-up using the function k_uptime_get() but it is always returning zero (0).

I am using an nRF5340PDK and Zephyr OS build v2.3.0-rc1-ncs1. The IDE used is SES for ARM (Nordic Edition) v5.10d (64-bit) running under windows 10.

This is what I am doing in my code.

#include <zephyr.h>

#include <kernel.h>

#include <sys/printk.h>

#include <stdio.h>

s64_t time_ms = k_uptime_get();

printf( "Booting-up @%i: \n", time_ms );

printk( "%i: ", time_ms );

Can someone please help?

Kind regards

Mohamed

Related