kfsw-platform/src/time.c
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include <stdint.h> | ||
| 2 | |||
| 3 | #include <zephyr/kernel.h> | ||
| 4 | |||
| 5 | #include <kfsw/platform/time.h> | ||
| 6 | |||
| 7 | 888 | uint64_t kfsw_time_monotonic_ms(void) | |
| 8 | { | ||
| 9 | 888 | return (uint64_t)k_uptime_get(); | |
| 10 | } | ||
| 11 | |||
| 12 | 140 | uint64_t kfsw_time_monotonic_us(void) | |
| 13 | { | ||
| 14 | if (IS_ENABLED(CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER)) { | ||
| 15 | 140 | return k_cyc_to_us_floor64(k_cycle_get_64()); | |
| 16 | } | ||
| 17 | |||
| 18 | return k_ticks_to_us_floor64(k_uptime_ticks()); | ||
| 19 | } | ||
| 20 |