mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(esp_libc): provide picolibc timespec_get
The Picolibc headers in the ESP-IDF v6.0 toolchain declare the C11 timespec_get API, but the corresponding archives do not define it. Provide the missing compatibility implementation through esp_libc and cover valid and invalid time bases.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
int timespec_get(struct timespec *ts, int base)
|
||||
{
|
||||
if (base != TIME_UTC || clock_gettime(CLOCK_REALTIME, ts) < 0) {
|
||||
return 0;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
Reference in New Issue
Block a user