Files
esp-idf/components/esp_libc/platform_include/time.h
Guillaume Souchere 9cea97187f fix(esp_libc): provide timespec_get missing from toolchain
Both newlib and picolibc headers in toolchain 16.1 declare timespec_get()
but the archives do not define it. Provide the missing C11 implementation
through esp_libc, mapping TIME_UTC to clock_gettime(CLOCK_REALTIME).

Closes https://github.com/espressif/esp-idf/issues/18889
2026-07-28 08:23:33 +02:00

36 lines
643 B
C

/*
* SPDX-FileCopyrightText: 2018-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <sys/types.h>
#include_next <time.h>
#ifdef __cplusplus
extern "C" {
#endif
#define _POSIX_TIMERS 1
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (clockid_t)4
#endif
#ifndef CLOCK_BOOTTIME
#define CLOCK_BOOTTIME (clockid_t)4
#endif
#ifndef TIME_UTC
#define TIME_UTC 1
#endif
int clock_settime(clockid_t clock_id, const struct timespec *tp);
int clock_gettime(clockid_t clock_id, struct timespec *tp);
int clock_getres(clockid_t clock_id, struct timespec *res);
#ifdef __cplusplus
}
#endif