1
0
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:
benpicco 2022-06-18 18:45:44 +02:00 committed by GitHub
commit e32c19f4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -117,5 +117,3 @@ endif
ifneq (,$(filter esp_jtag,$(USEMODULE)))
FEATURES_REQUIRED += esp_jtag
endif
USEMODULE += libc_gettimeofday

View File

@ -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__);