Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions include/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1676,22 +1676,26 @@ void k_disable_sys_clock_always_on(void);
/**
* @brief Get system uptime (32-bit version).
*
* This routine returns the lower 32-bits of the elapsed time since the system
* booted, in milliseconds.
* This routine returns the lower 32 bits of the system uptime in
* milliseconds.
*
* This routine can be more efficient than k_uptime_get(), as it reduces the
* need for interrupt locking and 64-bit math. However, the 32-bit result
* cannot hold a system uptime time larger than approximately 50 days, so the
* caller must handle possible rollovers.
* Because correct conversion requires full precision of the system
* clock there is no benefit to using this over k_uptime_get() unless
* you know the application will never run long enough for the system
* clock to approach 2^32 ticks. Calls to this function may involve
* interrupt blocking and 64-bit math.
*
* @note While this function returns time in milliseconds, it does not mean it
* has millisecond resolution. The actual resolution depends on
* :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` config option, and with the default
* setting of 100, system time is updated in increments of 10ms.
*
* @return Current uptime in milliseconds.
* @return The low 32 bits of the current uptime, in milliseconds.
*/
__syscall u32_t k_uptime_get_32(void);
static inline u32_t k_uptime_get_32(void)
{
return (u32_t)k_uptime_get();
}

/**
* @brief Get elapsed time.
Expand Down
12 changes: 0 additions & 12 deletions kernel/timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,6 @@ u32_t z_tick_get_32(void)
#endif
}

u32_t z_impl_k_uptime_get_32(void)
{
return __ticks_to_ms(z_tick_get_32());
}

#ifdef CONFIG_USERSPACE
Z_SYSCALL_HANDLER(k_uptime_get_32)
{
return z_impl_k_uptime_get_32();
}
#endif

s64_t z_impl_k_uptime_get(void)
{
return __ticks_to_ms(z_tick_get());
Expand Down