summaryrefslogtreecommitdiff
path: root/system/musl/0006-time-C11-visibility-fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/musl/0006-time-C11-visibility-fixes.patch')
-rw-r--r--system/musl/0006-time-C11-visibility-fixes.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/system/musl/0006-time-C11-visibility-fixes.patch b/system/musl/0006-time-C11-visibility-fixes.patch
new file mode 100644
index 000000000..5252611b5
--- /dev/null
+++ b/system/musl/0006-time-C11-visibility-fixes.patch
@@ -0,0 +1,51 @@
+From 0979c50b831c67e0b4f4a560435b867b35cdac67 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Tue, 17 Apr 2018 21:03:15 -0500
+Subject: [PATCH 6/7] 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.
+---
+ include/time.h | 7 +++++--
+ src/time/timespec_get.c | 2 +-
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/include/time.h b/include/time.h
+index 672b3fc3..c5946dd0 100644
+--- a/include/time.h
++++ b/include/time.h
+@@ -58,11 +58,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
++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) \
+diff --git a/src/time/timespec_get.c b/src/time/timespec_get.c
+index 03c5a77b..c423b825 100644
+--- a/src/time/timespec_get.c
++++ b/src/time/timespec_get.c
+@@ -6,7 +6,7 @@ int __clock_gettime(clockid_t, struct timespec *);
+ * are considered erroneous. */
+ int timespec_get(struct timespec * ts, int base)
+ {
+- if (base != TIME_UTC) return 0;
++ if (base != 1) return 0;
+ int ret = __clock_gettime(CLOCK_REALTIME, ts);
+ return ret < 0 ? 0 : base;
+ }
+--
+2.15.0
+