aboutsummaryrefslogtreecommitdiff
path: root/src/polyfill.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/polyfill.h')
-rw-r--r--src/polyfill.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/polyfill.h b/src/polyfill.h
index 5fa72ac..ecc3a0d 100644
--- a/src/polyfill.h
+++ b/src/polyfill.h
@@ -18,5 +18,23 @@ const char *janet_optcbytes(const Janet *argv, int32_t argc, int32_t n, const ch
static const int32_t CNAME##_sourceline_ = __LINE__; \
Janet CNAME (int32_t argc, Janet *argv)
#endif // !defined(JANET_NO_SOURCEMAPS)
-
#endif // JANET_VERSION_MAJOR < 2 && JANET_VERSION_MINOR < 28
+
+// ===
+
+// public domain code from
+// https://github.com/eggert/tz.git
+
+/* Infer TM_ZONE on systems where this information is known, but suppress
+ guessing if NO_TM_ZONE is defined. Similarly for TM_GMTOFF. */
+#if (defined __GLIBC__ \
+ || defined __tm_zone /* musl */ \
+ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
+ || (defined __APPLE__ && defined __MACH__))
+# if !defined TM_GMTOFF && !defined NO_TM_GMTOFF
+# define TM_GMTOFF tm_gmtoff
+# endif
+# if !defined TM_ZONE && !defined NO_TM_ZONE
+# define TM_ZONE tm_zone
+# endif
+#endif