mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Fix C11 and POSIX 1003.1b-1993 compliance in time.h
Only expose timespec_get in C11, C++17, or BSD code. Always define struct timespect if defining timespec_get. PR: 231425 Reviewed by: kib Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17174
This commit is contained in:
1 parent
9ed6559e3e
commit
d02489d11a
1 file changed
+4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338751
@@ -207,9 +207,13 @@ time_t posix2time(time_t t);
|
||||
#include <xlocale/_time.h>
|
||||
#endif
|
||||
|
||||
#if defined(__BSD_VISIBLE) || __ISO_C_VISIBLE >= 2011 || \
|
||||
(defined(cplusplus) && cplusplus >= 201703)
|
||||
#include <sys/_timespec.h>
|
||||
/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */
|
||||
#define TIME_UTC 1 /* time elapsed since epoch */
|
||||
int timespec_get(struct timespec *ts, int base);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
Reference in new issue
Block a user