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

Function _control_rtc

components/libc/compilers/common/ctime.c:93–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91
92#ifdef RT_USING_RTC
93static rt_err_t _control_rtc(int cmd, void *arg)
94{
95 static rt_device_t device = RT_NULL;
96 rt_err_t rst = -RT_ERROR;
97
98 if (device == RT_NULL)
99 {
100 device = rt_device_find("rtc");
101 }
102
103 /* read timestamp from RTC device */
104 if (device != RT_NULL)
105 {
106 if (rt_device_open(device, 0) == RT_EOK)
107 {
108 rst = rt_device_control(device, cmd, arg);
109 rt_device_close(device);
110 }
111 }
112 else
113 {
114 LOG_W(_WARNING_NO_RTC);
115 return -RT_ENOSYS;
116 }
117 return rst;
118}
119#endif /* RT_USING_RTC */
120
121/* lightweight timezone and daylight saving time */

Callers 9

timeFunction · 0.85
stimeFunction · 0.85
gettimeofdayFunction · 0.85
settimeofdayFunction · 0.85
clock_getresFunction · 0.85
clock_gettimeFunction · 0.85
clock_nanosleepFunction · 0.85
clock_settimeFunction · 0.85
timer_settimeFunction · 0.85

Calls 4

rt_device_findFunction · 0.85
rt_device_openFunction · 0.85
rt_device_controlFunction · 0.85
rt_device_closeFunction · 0.85

Tested by

no test coverage detected