diff syscalls.c @ 33:d3b7d4964807

Create a TZ info structure for ACST and use it when printing times.
author Daniel O'Connor <darius@dons.net.au>
date Tue, 27 Nov 2012 15:56:31 +1030
parents 435c6330896c
children 2ecde7a4bc55
line wrap: on
line diff
--- a/syscalls.c	Tue Nov 27 15:56:09 2012 +1030
+++ b/syscalls.c	Tue Nov 27 15:56:31 2012 +1030
@@ -147,11 +147,26 @@
 __tz_unlock (void) {
 }
 
+/* Set tzinfo directly so we don't need tzset() which requires getenv() */
+#ifdef USE_UTC
 static __tzinfo_type tzinfo = {1, 0,
     { {'J', 0, 0, 0, 0, (time_t)0, 0L },
       {'J', 0, 0, 0, 0, (time_t)0, 0L } 
     } 
 };
+#else
+/* ACST (south)
+ * Switch from DST 3am 1st Sunday of April:  -9.5 hours to UTC
+ * Switch  to  DST 2am 1st Sunday October:  -10.5 hours to UTC
+ *
+ * Copied from http://www.sourceware.org/ml/newlib/2008/msg00311.html
+ */
+static __tzinfo_type tzinfo = {0, 0, {
+	{'M',  4, 5, 0, 10800, (time_t)0, -37800L },
+	{'M', 10, 5, 0,  7200, (time_t)0, -34200L } 
+    }
+};
+#endif
 
 __tzinfo_type *
 __gettzinfo (void) {