libc: minimal: provide gmtime implementation

Implement the conversion from UNIX time to broken-down civil time per
the gmtime() and gmtime_r() functions.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-07-01 10:15:14 -05:00 committed by Carles Cufí
commit 3e8df8b369
3 changed files with 113 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_TIME_H_
#include <stdint.h>
#include <bits/restrict.h>
/* Minimal time.h to fulfill the requirements of certain libraries
* like mbedTLS and to support time APIs.
@ -38,6 +39,15 @@ struct timespec {
long tv_nsec;
};
/*
* Conversion between civil time and UNIX time. The companion
* localtime() and inverse mktime() are not provided here since they
* require access to time zone information.
*/
struct tm *gmtime(const time_t *timep);
struct tm *gmtime_r(const time_t *_MLIBC_RESTRICT timep,
struct tm *_MLIBC_RESTRICT result);
#ifdef __cplusplus
}
#endif