diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-04-17 21:03:15 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2023-05-05 21:21:37 -0500 |
commit | b1e554e906de3486d5ee82903cb61d4bfc6d4fab (patch) | |
tree | 1a36d3103855418c783fb41b94c38a6c505b5bfb /include/time.h | |
parent | 41735bdeff548ce44afe21aa21f1345047eb18e4 (diff) | |
download | musl-b1e554e906de3486d5ee82903cb61d4bfc6d4fab.tar.gz musl-b1e554e906de3486d5ee82903cb61d4bfc6d4fab.tar.bz2 musl-b1e554e906de3486d5ee82903cb61d4bfc6d4fab.tar.xz musl-b1e554e906de3486d5ee82903cb61d4bfc6d4fab.zip |
time: C11 visibility fixes
The timespec_get function, and TIME_* macros, are only in C11.
Since musl is compiled with -std=c99, TIME_UTC is unavailable in the
timespec_get implementation, so we use the raw value 1.
Diffstat (limited to 'include/time.h')
-rw-r--r-- | include/time.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/time.h b/include/time.h index 3d948372..deb4a450 100644 --- a/include/time.h +++ b/include/time.h @@ -60,11 +60,14 @@ struct tm *gmtime (const time_t *); struct tm *localtime (const time_t *); char *asctime (const struct tm *); char *ctime (const time_t *); -int timespec_get(struct timespec *, int); -#define CLOCKS_PER_SEC 1000000L +#if __STDC_VERSION__ >= 201112L || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +int timespec_get(struct timespec *, int); #define TIME_UTC 1 +#endif + +#define CLOCKS_PER_SEC 1000000L #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ @@ -139,7 +142,10 @@ __REDIR(mktime, __mktime64); __REDIR(gmtime, __gmtime64); __REDIR(localtime, __localtime64); __REDIR(ctime, __ctime64); +# if __STDC_VERSION__ >= 201112L || defined(_BSD_SOURCE) \ + || defined(_GNU_SOURCE) __REDIR(timespec_get, __timespec_get_time64); +# endif #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ || defined(_BSD_SOURCE) |