MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_ktime_boottime_get_us

Function rt_ktime_boottime_get_us

components/drivers/ktime/src/boottime.c:15–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#define __KTIME_MUL ((1000ULL * 1000 * 1000) / RT_TICK_PER_SECOND)
14
15rt_weak rt_err_t rt_ktime_boottime_get_us(struct timeval *tv)
16{
17 RT_ASSERT(tv != RT_NULL);
18
19 rt_uint64_t ns = (rt_ktime_cputimer_getcnt() * rt_ktime_cputimer_getres()) / RT_KTIME_RESMUL;
20
21 tv->tv_sec = ns / (1000ULL * 1000 * 1000);
22 tv->tv_usec = (ns % (1000ULL * 1000 * 1000)) / 1000;
23
24 return RT_EOK;
25}
26
27rt_weak rt_err_t rt_ktime_boottime_get_s(time_t *t)
28{

Callers 1

soft_rtc_controlFunction · 0.85

Calls 2

rt_ktime_cputimer_getcntFunction · 0.70
rt_ktime_cputimer_getresFunction · 0.50

Tested by

no test coverage detected