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

Function get_rtc_timestamp

bsp/at32/libraries/rt_drivers/drv_rtc.c:51–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49static struct rtc_device_object rtc_device;
50
51static time_t get_rtc_timestamp(void)
52{
53#if defined (SOC_SERIES_AT32F435) || defined (SOC_SERIES_AT32F437) || \
54 defined (SOC_SERIES_AT32F415) || defined (SOC_SERIES_AT32F421) || \
55 defined (SOC_SERIES_AT32F425) || defined (SOC_SERIES_AT32F423) || \
56 defined (SOC_SERIES_AT32F402) || defined (SOC_SERIES_AT32F405) || \
57 defined (SOC_SERIES_AT32A423) || defined (SOC_SERIES_AT32M412) || \
58 defined (SOC_SERIES_AT32M416) || defined (SOC_SERIES_AT32F455) || \
59 defined (SOC_SERIES_AT32F456) || defined (SOC_SERIES_AT32F457)
60 struct tm tm_new;
61 ertc_time_type ertc_time_struct;
62
63 ertc_calendar_get(&ertc_time_struct);
64
65 tm_new.tm_sec = ertc_time_struct.sec;
66 tm_new.tm_min = ertc_time_struct.min;
67 tm_new.tm_hour = ertc_time_struct.hour;
68 tm_new.tm_mday = ertc_time_struct.day;
69 tm_new.tm_mon = ertc_time_struct.month - 1;
70 tm_new.tm_year = ertc_time_struct.year + 100;
71
72 LOG_D("get rtc time.");
73
74 return timegm(&tm_new);
75#else
76 return rtc_counter_get();
77#endif
78}
79
80static rt_err_t set_rtc_time_stamp(time_t time_stamp)
81{

Callers 2

_rtc_get_secsFunction · 0.70
_rtc_get_timevalFunction · 0.70

Calls 2

timegmFunction · 0.85
rtc_counter_getFunction · 0.85

Tested by

no test coverage detected