k_uptime_get() #api

Mohamed Belaroussi

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 and tell me what I am doing wrong?
Thank you.

Kind regards


Join users@lists.zephyrproject.org to automatically receive all group messages.