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

k_uptime_get return a signed value

Hello,

I would like to use k_uptime_get, however this is returning an int64_t where I would expect an uint64_t.

While looking in the function, I see that k_uptime_get calls k_ticks_to_ms_floor64(k_uptime_ticks()); which should be returning an uint64_t.

What is the reason for this cast?

How is this counter computed? Is it reading a hardware register? Can this counter return to 0 in some cases (apart from a reboot)?

Thanks!

Parents Reply
  • Thanks for the answer Håkon.

    Once started (without the tickless option), can I safely assume that this counter won't restart to 0 unless the program runs for years and years (i.e. until 2^64 milliseconds) ?

    I see that the driver is returning 32bit values. Once we reach 2^32 milliseconds, will we restart to 0 even if we are using k_uptime_get which should return an 64bit?

    Best regards,
    Florian

Children
Related