mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #18202 from gschorcht/cpu/esp32/remove_dep_on_libc_gettimeofday
cpu/esp32: Remove dependency on module libc_gettimeofday
This commit is contained in:
commit
e32c19f4a3
@ -21,7 +21,6 @@ config CPU_FAM_ESP32
|
||||
|
||||
select PACKAGE_ESP32_SDK if TEST_KCONFIG
|
||||
|
||||
select MODULE_LIBC_GETTIMEOFDAY if TEST_KCONFIG
|
||||
select MODULE_MALLOC_THREAD_SAFE if !MODULE_ESP_IDF_HEAP && TEST_KCONFIG
|
||||
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
|
||||
select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
|
||||
|
@ -117,5 +117,3 @@ endif
|
||||
ifneq (,$(filter esp_jtag,$(USEMODULE)))
|
||||
FEATURES_REQUIRED += esp_jtag
|
||||
endif
|
||||
|
||||
USEMODULE += libc_gettimeofday
|
||||
|
@ -138,6 +138,17 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
||||
return clock_gettime_r(_GLOBAL_REENT, clock_id, tp);
|
||||
}
|
||||
|
||||
#if !IS_USED(MODULE_LIBC_GETTIMEOFDAY)
|
||||
int IRAM _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
|
||||
{
|
||||
(void) tz;
|
||||
uint64_t now = system_get_time_64();
|
||||
tv->tv_sec = div_u64_by_1000000(now);
|
||||
tv->tv_usec = now - (tv->tv_sec * US_PER_SEC);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _no_sys_func(struct _reent *r)
|
||||
{
|
||||
DEBUG("%s: system function does not exist\n", __func__);
|
||||
|
Loading…
Reference in New Issue
Block a user