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

Function set_timestamp

components/drivers/rtc/dev_rtc.c:238–251  ·  view source on GitHub ↗

* Set timestamp(UTC). * * @param time_t timestamp * * @return rt_err_t if set success, return RT_EOK. */

Source from the content-addressed store, hash-verified

236 * @return rt_err_t if set success, return RT_EOK.
237 */
238rt_err_t set_timestamp(time_t timestamp)
239{
240 if (_rtc_device == RT_NULL)
241 {
242 _rtc_device = rt_device_find("rtc");
243 if (_rtc_device == RT_NULL)
244 {
245 return -RT_ERROR;
246 }
247 }
248
249 /* update to RTC device. */
250 return rt_device_control(_rtc_device, RT_DEVICE_CTRL_RTC_SET_TIME, &timestamp);
251}
252
253/**
254 * Get timestamp(UTC).

Callers 1

dateFunction · 0.70

Calls 2

rt_device_findFunction · 0.85
rt_device_controlFunction · 0.85

Tested by

no test coverage detected