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:
parent
acc1703241
commit
3e8df8b369
3 changed files with 113 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue