From acc1703241b6ed4512c54e6880a3250aac324708 Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Thu, 11 Jul 2019 10:31:58 -0500 Subject: [PATCH] libc: minimal: provide types in time.h Provide definitions for a subset of the standard time types that must be provided by this file, in anticipation of supporting civil time in Zephyr. Signed-off-by: Peter A. Bigot --- lib/libc/minimal/include/time.h | 39 +++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/lib/libc/minimal/include/time.h b/lib/libc/minimal/include/time.h index ecb198e1ac8..b5deae5785b 100644 --- a/lib/libc/minimal/include/time.h +++ b/lib/libc/minimal/include/time.h @@ -1,10 +1,45 @@ /* * Copyright (c) 2017 Intel Corporation + * Copyright (c) 2019 Peter Bigot Consulting, LLC * * SPDX-License-Identifier: Apache-2.0 */ +#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_TIME_H_ +#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_TIME_H_ -/* Dummy time.h to fulfill the requirements of certain libraries - * i.e. mbedTLS +#include + +/* Minimal time.h to fulfill the requirements of certain libraries + * like mbedTLS and to support time APIs. */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +typedef int64_t time_t; +typedef int32_t suseconds_t; + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_ */