* Get timestamp(UTC). * * @param time_t* timestamp * * @return rt_err_t if set success, return RT_EOK. */
| 258 | * @return rt_err_t if set success, return RT_EOK. |
| 259 | */ |
| 260 | rt_err_t get_timestamp(time_t *timestamp) |
| 261 | { |
| 262 | if (_rtc_device == RT_NULL) |
| 263 | { |
| 264 | _rtc_device = rt_device_find("rtc"); |
| 265 | if (_rtc_device == RT_NULL) |
| 266 | { |
| 267 | return -RT_ERROR; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | /* Get timestamp from RTC device. */ |
| 272 | return rt_device_control(_rtc_device, RT_DEVICE_CTRL_RTC_GET_TIME, timestamp); |
| 273 | } |
| 274 | |
| 275 | #ifdef RT_USING_FINSH |
| 276 | #include <finsh.h> |
no test coverage detected