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

Function time

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

* Returns the current time. * * @param time_t * t the timestamp pointer, if not used, keep NULL. * * @return The value ((time_t)-1) is returned if the calendar time is not available. * If timer is not a NULL pointer, the return value is also stored in timer. * */

Source from the content-addressed store, hash-verified

338 *
339 */
340rt_weak time_t time(time_t *t)
341{
342#ifdef RT_USING_RTC
343 time_t _t;
344
345 if (_control_rtc(RT_DEVICE_CTRL_RTC_GET_TIME, &_t) != RT_EOK)
346 {
347 rt_set_errno(EFAULT);
348 return (time_t)-1;
349 }
350
351 if (t)
352 *t = _t;
353
354 return _t;
355#else
356 rt_set_errno(EFAULT);
357 return (time_t)-1;
358#endif
359}
360RTM_EXPORT(time);
361
362rt_weak clock_t clock(void)

Callers 15

syslog_formaterFunction · 0.85
__ARM_TPL_clock_realtimeFunction · 0.85
ppp_vslprintfFunction · 0.85
pncrypt_setkeyFunction · 0.85
ppp_vslprintfFunction · 0.85
pncrypt_setkeyFunction · 0.85
get_fattimeFunction · 0.85
get_fattimeFunction · 0.85
utimensatFunction · 0.85
test_rtc_setFunction · 0.85
test_rtc_alarmFunction · 0.85
test_rtc_interfaceFunction · 0.85

Calls 2

_control_rtcFunction · 0.85
rt_set_errnoFunction · 0.85

Tested by 8

test_rtc_setFunction · 0.68
test_rtc_alarmFunction · 0.68
test_rtc_interfaceFunction · 0.68
rtc_sampleFunction · 0.68
test_rtcFunction · 0.68
init_random_keysFunction · 0.68
randomizeFunction · 0.68
rtc_testFunction · 0.68