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

Function pico_rtc_get_timeval

bsp/raspberry-pico/Drivers/drv_rtc.c:27–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25static struct rtc_device_object rtc_device;
26
27static rt_err_t pico_rtc_get_timeval(struct timeval *tv)
28{
29 datetime_t t;
30 struct tm tm_new = {0};
31 rtc_get_datetime(&t);
32
33 tm_new.tm_sec = t.sec;
34 tm_new.tm_min = t.min;
35 tm_new.tm_hour = t.hour;
36 tm_new.tm_wday = t.dotw;
37 tm_new.tm_mday = t.day;
38 tm_new.tm_mon = t.month - 1;
39 tm_new.tm_year = t.year - 1900;
40
41 tv->tv_sec = timegm(&tm_new);
42
43 return RT_EOK;
44}
45
46static rt_err_t pico_rtc_init(void)
47{

Callers 1

pico_rtc_get_secsFunction · 0.85

Calls 1

timegmFunction · 0.85

Tested by

no test coverage detected