diff --git a/libc/docs/OVERVIEW.TXT b/libc/docs/OVERVIEW.TXT
index 4c153b1..753e48a 100644
--- a/libc/docs/OVERVIEW.TXT
+++ b/libc/docs/OVERVIEW.TXT
@@ -63,6 +63,18 @@
   Instead, Bionic provides a <time64.h> header that defines a time64_t type,
   and related functions like mktime64(), localtime64(), etc...
 
+  strftime() uses time64_t internally, so the '%s' format (seconds since the
+  epoch) is supported for dates >= 2038.
+
+
+strftime_tz():
+
+  Bionic also provides the non-standard strftime_tz() function, a variant
+  of strftime() which also accepts a time locale descriptor as defined
+  by "struct strftime_locale" in <time.h>.
+
+  This function is used by the low-level framework code in Android.
+
 
 Timezone management:
 
diff --git a/libc/include/arpa/inet.h b/libc/include/arpa/inet.h
index 3ebb872..e78e7c5 100644
--- a/libc/include/arpa/inet.h
+++ b/libc/include/arpa/inet.h
@@ -31,7 +31,6 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include <netinet/in.h>
-#include <netinet/in6.h>
 
 __BEGIN_DECLS
 
diff --git a/libc/include/netinet/in.h b/libc/include/netinet/in.h
index 77ae506..0ebd926 100644
--- a/libc/include/netinet/in.h
+++ b/libc/include/netinet/in.h
@@ -32,6 +32,7 @@
 #include <linux/socket.h>
 #include <linux/in.h>
 #include <linux/in6.h>
+#include <netinet/in6.h>
 
 __BEGIN_DECLS
 
@@ -39,6 +40,9 @@
 
 extern int bindresvport (int sd, struct sockaddr_in *sin);
 
+static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
+
 __END_DECLS
 
 #endif /* _NETINET_IN_H_ */
diff --git a/libc/include/netinet/in6.h b/libc/include/netinet/in6.h
index e645c48..2f5fee1 100644
--- a/libc/include/netinet/in6.h
+++ b/libc/include/netinet/in6.h
@@ -90,4 +90,12 @@
 
 #define INET6_ADDRSTRLEN 46
 
+#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
+#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
+
+#define IN6ADDR_ANY_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}
+
+#define ipv6mr_interface ipv6mr_ifindex
+
+
 #endif /* _NETINET_IN6_H */
diff --git a/libc/include/time.h b/libc/include/time.h
index 35c2358..14066a1 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -79,9 +79,29 @@
 extern char*       strptime(const char *buf, const char *fmt, struct tm *tm);
 extern size_t      strftime(char *s, size_t max, const char *format, const struct tm *tm);
 
+/* ANDROID-BEGIN */
+struct strftime_locale {
+    const char *  mon[12];
+    const char *  month[12];
+    const char *  standalone_month[12];
+    const char *  wday[7];
+    const char *  weekday[7];
+    const char *  X_fmt;
+    const char *  x_fmt;
+    const char *  c_fmt;
+    const char *  am;
+    const char *  pm;
+    const char *  date_fmt;
+};
+
+extern size_t      strftime_tz(char *s, size_t max, const char *format, const struct tm *tm, const struct strftime_locale*  lc);
+/* ANDROID-END */
+
 extern char *ctime(const time_t *timep);
 extern char *ctime_r(const time_t *timep, char *buf);
 
+extern void  tzset(void);
+
 /* global includes */
 extern char*     tzname[];
 extern int       daylight;
diff --git a/libc/kernel/common/linux/akm8973.h b/libc/kernel/common/linux/akm8973.h
new file mode 100644
index 0000000..2892f72
--- /dev/null
+++ b/libc/kernel/common/linux/akm8973.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef AKM8973_H
+#define AKM8973_H
+
+#include <linux/ioctl.h>
+
+#define AKMIO 0xA1
+
+#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char[5])
+#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char[5])
+#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
+#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
+#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[RBUFF_SIZE+1])
+#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
+#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
+
+#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
+#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
+#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
+#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
+#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
+#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
+#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
+#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
+
+#define ECS_IOCTL_SET_STEP_CNT _IOW(AKMIO, 0x20, short)
+#endif
+
+
diff --git a/libc/kernel/common/linux/capella_cm3602.h b/libc/kernel/common/linux/capella_cm3602.h
new file mode 100644
index 0000000..6391e8a
--- /dev/null
+++ b/libc/kernel/common/linux/capella_cm3602.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_CAPELLA_CM3602_H
+#define __LINUX_CAPELLA_CM3602_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define CAPELLA_CM3602_IOCTL_MAGIC 'c'
+#define CAPELLA_CM3602_IOCTL_GET_ENABLED   _IOR(CAPELLA_CM3602_IOCTL_MAGIC, 1, int *)
+#define CAPELLA_CM3602_IOCTL_ENABLE   _IOW(CAPELLA_CM3602_IOCTL_MAGIC, 2, int *)
+
+#endif
+
diff --git a/libc/netbsd/resolv/res_send.c b/libc/netbsd/resolv/res_send.c
index 3aca760..696f8cf 100644
--- a/libc/netbsd/resolv/res_send.c
+++ b/libc/netbsd/resolv/res_send.c
@@ -95,7 +95,6 @@
 #include <sys/uio.h>
 
 #include <netinet/in.h>
-#include <netinet/in6.h>
 #include "arpa_nameser.h"
 #include <arpa/inet.h>
 
diff --git a/libc/tzcode/asctime.c b/libc/tzcode/asctime.c
index e0804f1..22bba34 100644
--- a/libc/tzcode/asctime.c
+++ b/libc/tzcode/asctime.c
@@ -11,7 +11,7 @@
 
 #ifndef lint
 #ifndef NOID
-static char	elsieid[] = "@(#)asctime.c	8.2";
+static char elsieid[] = "@(#)asctime.c  8.2";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -39,9 +39,9 @@
 ** but many implementations pad anyway; most likely the standards are buggy.
 */
 #ifdef __GNUC__
-#define ASCTIME_FMT	"%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n"
+#define ASCTIME_FMT "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n"
 #else /* !defined __GNUC__ */
-#define ASCTIME_FMT	"%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n"
+#define ASCTIME_FMT "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n"
 #endif /* !defined __GNUC__ */
 /*
 ** For years that are more than four digits we put extra spaces before the year
@@ -50,12 +50,12 @@
 ** that no output is better than wrong output).
 */
 #ifdef __GNUC__
-#define ASCTIME_FMT_B	"%.3s %.3s%3d %2.2d:%2.2d:%2.2d     %s\n"
+#define ASCTIME_FMT_B   "%.3s %.3s%3d %2.2d:%2.2d:%2.2d     %s\n"
 #else /* !defined __GNUC__ */
-#define ASCTIME_FMT_B	"%.3s %.3s%3d %02.2d:%02.2d:%02.2d     %s\n"
+#define ASCTIME_FMT_B   "%.3s %.3s%3d %02.2d:%02.2d:%02.2d     %s\n"
 #endif /* !defined __GNUC__ */
 
-#define STD_ASCTIME_BUF_SIZE	26
+#define STD_ASCTIME_BUF_SIZE    26
 /*
 ** Big enough for something such as
 ** ??? ???-2147483648 -2147483648:-2147483648:-2147483648     -2147483648\n
@@ -66,9 +66,9 @@
 ** as an example; the define below calculates the maximum for the system at
 ** hand.
 */
-#define MAX_ASCTIME_BUF_SIZE	(2*3+5*INT_STRLEN_MAXIMUM(int)+7+2+1+1)
+#define MAX_ASCTIME_BUF_SIZE    (2*3+5*INT_STRLEN_MAXIMUM(int)+7+2+1+1)
 
-static char	buf_asctime[MAX_ASCTIME_BUF_SIZE];
+static char buf_asctime[MAX_ASCTIME_BUF_SIZE];
 
 /*
 ** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
@@ -76,54 +76,54 @@
 
 char *
 asctime_r(timeptr, buf)
-register const struct tm *	timeptr;
-char *				buf;
+register const struct tm *  timeptr;
+char *              buf;
 {
-	static const char	wday_name[][3] = {
-		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-	};
-	static const char	mon_name[][3] = {
-		"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-	};
-	register const char *	wn;
-	register const char *	mn;
-	char			year[INT_STRLEN_MAXIMUM(int) + 2];
-	char			result[MAX_ASCTIME_BUF_SIZE];
+    static const char   wday_name[][3] = {
+        "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+    };
+    static const char   mon_name[][3] = {
+        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+    };
+    register const char *   wn;
+    register const char *   mn;
+    char            year[INT_STRLEN_MAXIMUM(int) + 2];
+    char            result[MAX_ASCTIME_BUF_SIZE];
 
-	if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
-		wn = "???";
-	else	wn = wday_name[timeptr->tm_wday];
-	if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
-		mn = "???";
-	else	mn = mon_name[timeptr->tm_mon];
-	/*
-	** Use strftime's %Y to generate the year, to avoid overflow problems
-	** when computing timeptr->tm_year + TM_YEAR_BASE.
-	** Assume that strftime is unaffected by other out-of-range members
-	** (e.g., timeptr->tm_mday) when processing "%Y".
-	*/
-	(void) strftime(year, sizeof year, "%Y", timeptr);
-	/*
-	** We avoid using snprintf since it's not available on all systems.
-	*/
-	(void) sprintf(result,
-		((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
-		wn, mn,
-		timeptr->tm_mday, timeptr->tm_hour,
-		timeptr->tm_min, timeptr->tm_sec,
-		year);
-	if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) {
-		(void) strcpy(buf, result);
-		return buf;
-	} else {
+    if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
+        wn = "???";
+    else    wn = wday_name[timeptr->tm_wday];
+    if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
+        mn = "???";
+    else    mn = mon_name[timeptr->tm_mon];
+    /*
+    ** Use strftime's %Y to generate the year, to avoid overflow problems
+    ** when computing timeptr->tm_year + TM_YEAR_BASE.
+    ** Assume that strftime is unaffected by other out-of-range members
+    ** (e.g., timeptr->tm_mday) when processing "%Y".
+    */
+    (void) strftime(year, sizeof year, "%Y", timeptr);
+    /*
+    ** We avoid using snprintf since it's not available on all systems.
+    */
+    (void) sprintf(result,
+        ((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
+        wn, mn,
+        timeptr->tm_mday, timeptr->tm_hour,
+        timeptr->tm_min, timeptr->tm_sec,
+        year);
+    if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) {
+        (void) strcpy(buf, result);
+        return buf;
+    } else {
 #ifdef EOVERFLOW
-		errno = EOVERFLOW;
+        errno = EOVERFLOW;
 #else /* !defined EOVERFLOW */
-		errno = EINVAL;
+        errno = EINVAL;
 #endif /* !defined EOVERFLOW */
-		return NULL;
-	}
+        return NULL;
+    }
 }
 
 /*
@@ -132,7 +132,7 @@
 
 char *
 asctime(timeptr)
-register const struct tm *	timeptr;
+register const struct tm *  timeptr;
 {
-	return asctime_r(timeptr, buf_asctime);
+    return asctime_r(timeptr, buf_asctime);
 }
diff --git a/libc/tzcode/difftime.c b/libc/tzcode/difftime.c
index da77977..f7581a4 100644
--- a/libc/tzcode/difftime.c
+++ b/libc/tzcode/difftime.c
@@ -5,61 +5,61 @@
 
 #ifndef lint
 #ifndef NOID
-static char	elsieid[] = "@(#)difftime.c	8.1";
+static char elsieid[] = "@(#)difftime.c 8.1";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
 /*LINTLIBRARY*/
 
-#include "private.h"	/* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
+#include "private.h"    /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
 
 double
 difftime(time1, time0)
-const time_t	time1;
-const time_t	time0;
+const time_t    time1;
+const time_t    time0;
 {
-	/*
-	** If (sizeof (double) > sizeof (time_t)) simply convert and subtract
-	** (assuming that the larger type has more precision).
-	** This is the common real-world case circa 2004.
-	*/
-	if (sizeof (double) > sizeof (time_t))
-		return (double) time1 - (double) time0;
-	if (!TYPE_INTEGRAL(time_t)) {
-		/*
-		** time_t is floating.
-		*/
-		return time1 - time0;
-	}
-	if (!TYPE_SIGNED(time_t)) {
-		/*
-		** time_t is integral and unsigned.
-		** The difference of two unsigned values can't overflow
-		** if the minuend is greater than or equal to the subtrahend.
-		*/
-		if (time1 >= time0)
-			return time1 - time0;
-		else	return -((double) (time0 - time1));
-	}
-	/*
-	** time_t is integral and signed.
-	** Handle cases where both time1 and time0 have the same sign
-	** (meaning that their difference cannot overflow).
-	*/
-	if ((time1 < 0) == (time0 < 0))
-		return time1 - time0;
-	/*
-	** time1 and time0 have opposite signs.
-	** Punt if unsigned long is too narrow.
-	*/
-	if (sizeof (unsigned long) < sizeof (time_t))
-		return (double) time1 - (double) time0;
-	/*
-	** Stay calm...decent optimizers will eliminate the complexity below.
-	*/
-	if (time1 >= 0 /* && time0 < 0 */)
-		return (unsigned long) time1 +
-			(unsigned long) (-(time0 + 1)) + 1;
-	return -(double) ((unsigned long) time0 +
-		(unsigned long) (-(time1 + 1)) + 1);
+    /*
+    ** If (sizeof (double) > sizeof (time_t)) simply convert and subtract
+    ** (assuming that the larger type has more precision).
+    ** This is the common real-world case circa 2004.
+    */
+    if (sizeof (double) > sizeof (time_t))
+        return (double) time1 - (double) time0;
+    if (!TYPE_INTEGRAL(time_t)) {
+        /*
+        ** time_t is floating.
+        */
+        return time1 - time0;
+    }
+    if (!TYPE_SIGNED(time_t)) {
+        /*
+        ** time_t is integral and unsigned.
+        ** The difference of two unsigned values can't overflow
+        ** if the minuend is greater than or equal to the subtrahend.
+        */
+        if (time1 >= time0)
+            return time1 - time0;
+        else    return -((double) (time0 - time1));
+    }
+    /*
+    ** time_t is integral and signed.
+    ** Handle cases where both time1 and time0 have the same sign
+    ** (meaning that their difference cannot overflow).
+    */
+    if ((time1 < 0) == (time0 < 0))
+        return time1 - time0;
+    /*
+    ** time1 and time0 have opposite signs.
+    ** Punt if unsigned long is too narrow.
+    */
+    if (sizeof (unsigned long) < sizeof (time_t))
+        return (double) time1 - (double) time0;
+    /*
+    ** Stay calm...decent optimizers will eliminate the complexity below.
+    */
+    if (time1 >= 0 /* && time0 < 0 */)
+        return (unsigned long) time1 +
+            (unsigned long) (-(time0 + 1)) + 1;
+    return -(double) ((unsigned long) time0 +
+        (unsigned long) (-(time1 + 1)) + 1);
 }
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index 19d0fbc..9c5f218 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -5,7 +5,7 @@
 
 #ifndef lint
 #ifndef NOID
-static char	elsieid[] = "@(#)localtime.c	8.3";
+static char elsieid[] = "@(#)localtime.c    8.3";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -19,21 +19,22 @@
 #include "private.h"
 #include "tzfile.h"
 #include "fcntl.h"
-#include "float.h"	/* for FLT_MAX and DBL_MAX */
+#include "float.h"  /* for FLT_MAX and DBL_MAX */
 
+#include "thread_private.h"
 #include <sys/system_properties.h>
 
 #ifndef TZ_ABBR_MAX_LEN
-#define TZ_ABBR_MAX_LEN	16
+#define TZ_ABBR_MAX_LEN 16
 #endif /* !defined TZ_ABBR_MAX_LEN */
 
 #ifndef TZ_ABBR_CHAR_SET
 #define TZ_ABBR_CHAR_SET \
-	"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"
+    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"
 #endif /* !defined TZ_ABBR_CHAR_SET */
 
 #ifndef TZ_ABBR_ERR_CHAR
-#define TZ_ABBR_ERR_CHAR	'_'
+#define TZ_ABBR_ERR_CHAR    '_'
 #endif /* !defined TZ_ABBR_ERR_CHAR */
 
 #define INDEXFILE "/system/usr/share/zoneinfo/zoneinfo.idx"
@@ -47,10 +48,10 @@
 */
 
 #ifdef O_BINARY
-#define OPEN_MODE	(O_RDONLY | O_BINARY)
+#define OPEN_MODE   (O_RDONLY | O_BINARY)
 #endif /* defined O_BINARY */
 #ifndef O_BINARY
-#define OPEN_MODE	O_RDONLY
+#define OPEN_MODE   O_RDONLY
 #endif /* !defined O_BINARY */
 
 #if 0
@@ -59,19 +60,33 @@
 #  define  XLOG(x)   do{}while (0)
 #endif
 
+/* THREAD-SAFETY SUPPORT GOES HERE */
+static pthread_mutex_t  _tzMutex = PTHREAD_MUTEX_INITIALIZER;
+
+static __inline__ void _tzLock(void)
+{
+    if (__isthreaded)
+        pthread_mutex_lock(&_tzMutex);
+}
+
+static __inline__ void _tzUnlock(void)
+{
+    if (__isthreaded)
+        pthread_mutex_unlock(&_tzMutex);
+}
 
 #ifndef WILDABBR
 /*
 ** Someone might make incorrect use of a time zone abbreviation:
-**	1.	They might reference tzname[0] before calling tzset (explicitly
-**		or implicitly).
-**	2.	They might reference tzname[1] before calling tzset (explicitly
-**		or implicitly).
-**	3.	They might reference tzname[1] after setting to a time zone
-**		in which Daylight Saving Time is never observed.
-**	4.	They might reference tzname[0] after setting to a time zone
-**		in which Standard Time is never observed.
-**	5.	They might reference tm.TM_ZONE after calling offtime.
+**  1.  They might reference tzname[0] before calling tzset (explicitly
+**      or implicitly).
+**  2.  They might reference tzname[1] before calling tzset (explicitly
+**      or implicitly).
+**  3.  They might reference tzname[1] after setting to a time zone
+**      in which Daylight Saving Time is never observed.
+**  4.  They might reference tzname[0] after setting to a time zone
+**      in which Standard Time is never observed.
+**  5.  They might reference tm.TM_ZONE after calling offtime.
 ** What's best to do in the above cases is open to debate;
 ** for now, we just set things up so that in any of the five cases
 ** WILDABBR is used. Another possibility: initialize tzname[0] to the
@@ -80,12 +95,12 @@
 ** manual page of what this "time zone abbreviation" means (doing this so
 ** that tzname[0] has the "normal" length of three characters).
 */
-#define WILDABBR	"   "
+#define WILDABBR    "   "
 #endif /* !defined WILDABBR */
 
-static char		wildabbr[] = WILDABBR;
+static char     wildabbr[] = WILDABBR;
 
-static const char	gmt[] = "GMT";
+static const char   gmt[] = "GMT";
 
 /*
 ** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
@@ -98,251 +113,257 @@
 #define TZDEFRULESTRING ",M4.1.0,M10.5.0"
 #endif /* !defined TZDEFDST */
 
-struct ttinfo {				/* time type information */
-	long		tt_gmtoff;	/* UTC offset in seconds */
-	int		tt_isdst;	/* used to set tm_isdst */
-	int		tt_abbrind;	/* abbreviation list index */
-	int		tt_ttisstd;	/* TRUE if transition is std time */
-	int		tt_ttisgmt;	/* TRUE if transition is UTC */
+struct ttinfo {             /* time type information */
+    long    tt_gmtoff;  /* UTC offset in seconds */
+    int     tt_isdst;   /* used to set tm_isdst */
+    int     tt_abbrind; /* abbreviation list index */
+    int     tt_ttisstd; /* TRUE if transition is std time */
+    int     tt_ttisgmt; /* TRUE if transition is UTC */
 };
 
-struct lsinfo {				/* leap second information */
-	time_t		ls_trans;	/* transition time */
-	long		ls_corr;	/* correction to apply */
+struct lsinfo {             /* leap second information */
+    time_t      ls_trans;   /* transition time */
+    long        ls_corr;    /* correction to apply */
 };
 
-#define BIGGEST(a, b)	(((a) > (b)) ? (a) : (b))
+#define BIGGEST(a, b)   (((a) > (b)) ? (a) : (b))
 
 #ifdef TZNAME_MAX
-#define MY_TZNAME_MAX	TZNAME_MAX
+#define MY_TZNAME_MAX   TZNAME_MAX
 #endif /* defined TZNAME_MAX */
 #ifndef TZNAME_MAX
-#define MY_TZNAME_MAX	255
+#define MY_TZNAME_MAX   255
 #endif /* !defined TZNAME_MAX */
 
+/* XXX: This code should really use time64_t instead of time_t
+ *      but we can't change it without re-generating the index
+ *      file first with the correct data.
+ */
 struct state {
-	int		leapcnt;
-	int		timecnt;
-	int		typecnt;
-	int		charcnt;
-	int		goback;
-	int		goahead;
-	time_t		ats[TZ_MAX_TIMES];
-	unsigned char	types[TZ_MAX_TIMES];
-	struct ttinfo	ttis[TZ_MAX_TYPES];
-	char		chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
-				(2 * (MY_TZNAME_MAX + 1)))];
-	struct lsinfo	lsis[TZ_MAX_LEAPS];
+    int     leapcnt;
+    int     timecnt;
+    int     typecnt;
+    int     charcnt;
+    int     goback;
+    int     goahead;
+    time_t      ats[TZ_MAX_TIMES];
+    unsigned char   types[TZ_MAX_TIMES];
+    struct ttinfo   ttis[TZ_MAX_TYPES];
+    char        chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
+                (2 * (MY_TZNAME_MAX + 1)))];
+    struct lsinfo   lsis[TZ_MAX_LEAPS];
 };
 
 struct rule {
-	int		r_type;		/* type of rule--see below */
-	int		r_day;		/* day number of rule */
-	int		r_week;		/* week number of rule */
-	int		r_mon;		/* month number of rule */
-	long		r_time;		/* transition time of rule */
+    int     r_type;     /* type of rule--see below */
+    int     r_day;      /* day number of rule */
+    int     r_week;     /* week number of rule */
+    int     r_mon;      /* month number of rule */
+    long        r_time;     /* transition time of rule */
 };
 
-#define JULIAN_DAY		0	/* Jn - Julian day */
-#define DAY_OF_YEAR		1	/* n - day of year */
-#define MONTH_NTH_DAY_OF_WEEK	2	/* Mm.n.d - month, week, day of week */
+#define JULIAN_DAY      0   /* Jn - Julian day */
+#define DAY_OF_YEAR     1   /* n - day of year */
+#define MONTH_NTH_DAY_OF_WEEK   2   /* Mm.n.d - month, week, day of week */
 
 /*
 ** Prototypes for static functions.
 */
 
-static long		detzcode P((const char * codep));
-static time_t		detzcode64 P((const char * codep));
-static int		differ_by_repeat P((time_t t1, time_t t0));
-static const char *	getzname P((const char * strp));
-static const char *	getqzname P((const char * strp, const int delim));
-static const char *	getnum P((const char * strp, int * nump, int min,
-				int max));
-static const char *	getsecs P((const char * strp, long * secsp));
-static const char *	getoffset P((const char * strp, long * offsetp));
-static const char *	getrule P((const char * strp, struct rule * rulep));
-static void		gmtload P((struct state * sp));
-static struct tm *	gmtsub P((const time_t * timep, long offset,
-				struct tm * tmp));
-static struct tm *	localsub P((const time_t * timep, long offset,
-				struct tm * tmp));
-static int		increment_overflow P((int * number, int delta));
-static int		leaps_thru_end_of P((int y));
-static int		long_increment_overflow P((long * number, int delta));
-static int		long_normalize_overflow P((long * tensptr,
-				int * unitsptr, int base));
-static int		normalize_overflow P((int * tensptr, int * unitsptr,
-				int base));
-static void		settzname P((void));
-static time_t		time1 P((struct tm * tmp,
-				struct tm * (*funcp) P((const time_t *,
-				long, struct tm *)),
-				long offset));
-static time_t		time2 P((struct tm *tmp,
-				struct tm * (*funcp) P((const time_t *,
-				long, struct tm*)),
-				long offset, int * okayp));
-static time_t		time2sub P((struct tm *tmp,
-				struct tm * (*funcp) P((const time_t *,
-				long, struct tm*)),
-				long offset, int * okayp, int do_norm_secs));
-static struct tm *	timesub P((const time_t * timep, long offset,
-				const struct state * sp, struct tm * tmp));
-static int		tmcomp P((const struct tm * atmp,
-				const struct tm * btmp));
-static time_t		transtime P((time_t janfirst, int year,
-				const struct rule * rulep, long offset));
-static int		tzload P((const char * name, struct state * sp,
-				int doextend));
-static int		tzparse P((const char * name, struct state * sp,
-				int lastditch));
+/* NOTE: all internal functions assume that _tzLock() was already called */
+
+static long     detzcode P((const char * codep));
+static time_t   detzcode64 P((const char * codep));
+static int      differ_by_repeat P((time_t t1, time_t t0));
+static const char * getzname P((const char * strp));
+static const char * getqzname P((const char * strp, const int delim));
+static const char * getnum P((const char * strp, int * nump, int min,
+                int max));
+static const char * getsecs P((const char * strp, long * secsp));
+static const char * getoffset P((const char * strp, long * offsetp));
+static const char * getrule P((const char * strp, struct rule * rulep));
+static void     gmtload P((struct state * sp));
+static struct tm *  gmtsub P((const time_t * timep, long offset,
+                struct tm * tmp));
+static struct tm *  localsub P((const time_t * timep, long offset,
+                struct tm * tmp));
+static int      increment_overflow P((int * number, int delta));
+static int      leaps_thru_end_of P((int y));
+static int      long_increment_overflow P((long * number, int delta));
+static int      long_normalize_overflow P((long * tensptr,
+                int * unitsptr, int base));
+static int      normalize_overflow P((int * tensptr, int * unitsptr,
+                int base));
+static void     settzname P((void));
+static time_t       time1 P((struct tm * tmp,
+                struct tm * (*funcp) P((const time_t *,
+                long, struct tm *)),
+                long offset));
+static time_t       time2 P((struct tm *tmp,
+                struct tm * (*funcp) P((const time_t *,
+                long, struct tm*)),
+                long offset, int * okayp));
+static time_t       time2sub P((struct tm *tmp,
+                struct tm * (*funcp) P((const time_t *,
+                long, struct tm*)),
+                long offset, int * okayp, int do_norm_secs));
+static struct tm *  timesub P((const time_t * timep, long offset,
+                const struct state * sp, struct tm * tmp));
+static int      tmcomp P((const struct tm * atmp,
+                const struct tm * btmp));
+static time_t       transtime P((time_t janfirst, int year,
+                const struct rule * rulep, long offset));
+static int      tzload P((const char * name, struct state * sp,
+                int doextend));
+static int      tzparse P((const char * name, struct state * sp,
+                int lastditch));
 
 #ifdef ALL_STATE
-static struct state *	lclptr;
-static struct state *	gmtptr;
+static struct state *   lclptr;
+static struct state *   gmtptr;
 #endif /* defined ALL_STATE */
 
 #ifndef ALL_STATE
-static struct state	lclmem;
-static struct state	gmtmem;
-#define lclptr		(&lclmem)
-#define gmtptr		(&gmtmem)
+static struct state lclmem;
+static struct state gmtmem;
+#define lclptr      (&lclmem)
+#define gmtptr      (&gmtmem)
 #endif /* State Farm */
 
 #ifndef TZ_STRLEN_MAX
 #define TZ_STRLEN_MAX 255
 #endif /* !defined TZ_STRLEN_MAX */
 
-static char		lcl_TZname[TZ_STRLEN_MAX + 1];
-static int		lcl_is_set;
-static int		gmt_is_set;
+static char     lcl_TZname[TZ_STRLEN_MAX + 1];
+static int      lcl_is_set;
+static int      gmt_is_set;
 
-char *			tzname[2] = {
-	wildabbr,
-	wildabbr
+char *          tzname[2] = {
+    wildabbr,
+    wildabbr
 };
 
 /*
 ** Section 4.12.3 of X3.159-1989 requires that
-**	Except for the strftime function, these functions [asctime,
-**	ctime, gmtime, localtime] return values in one of two static
-**	objects: a broken-down time structure and an array of char.
+**  Except for the strftime function, these functions [asctime,
+**  ctime, gmtime, localtime] return values in one of two static
+**  objects: a broken-down time structure and an array of char.
 ** Thanks to Paul Eggert for noting this.
 */
 
-static struct tm	tm;
+static struct tm    tmGlobal;
 
 #ifdef USG_COMPAT
-time_t			timezone = 0;
-int			daylight = 0;
+time_t          timezone = 0;
+int         daylight = 0;
 #endif /* defined USG_COMPAT */
 
 #ifdef ALTZONE
-time_t			altzone = 0;
+time_t          altzone = 0;
 #endif /* defined ALTZONE */
 
 static long
 detzcode(codep)
-const char * const	codep;
+const char * const  codep;
 {
-	register long	result;
-	register int	i;
+    register long   result;
+    register int    i;
 
-	result = (codep[0] & 0x80) ? ~0L : 0;
-	for (i = 0; i < 4; ++i)
-		result = (result << 8) | (codep[i] & 0xff);
-	return result;
+    result = (codep[0] & 0x80) ? ~0L : 0;
+    for (i = 0; i < 4; ++i)
+        result = (result << 8) | (codep[i] & 0xff);
+    return result;
 }
 
 static time_t
 detzcode64(codep)
-const char * const	codep;
+const char * const  codep;
 {
-	register time_t	result;
-	register int	i;
+    register time_t result;
+    register int    i;
 
-	result = (codep[0] & 0x80) ?  (~(int_fast64_t) 0) : 0;
-	for (i = 0; i < 8; ++i)
-		result = result * 256 + (codep[i] & 0xff);
-	return result;
+    result = (codep[0] & 0x80) ?  (~(int_fast64_t) 0) : 0;
+    for (i = 0; i < 8; ++i)
+        result = result * 256 + (codep[i] & 0xff);
+    return result;
 }
 
 static void
 settzname P((void))
 {
-	register struct state * const	sp = lclptr;
-	register int			i;
+    register struct state * const   sp = lclptr;
+    register int            i;
 
-	tzname[0] = wildabbr;
-	tzname[1] = wildabbr;
+    tzname[0] = wildabbr;
+    tzname[1] = wildabbr;
 #ifdef USG_COMPAT
-	daylight = 0;
-	timezone = 0;
+    daylight = 0;
+    timezone = 0;
 #endif /* defined USG_COMPAT */
 #ifdef ALTZONE
-	altzone = 0;
+    altzone = 0;
 #endif /* defined ALTZONE */
 #ifdef ALL_STATE
-	if (sp == NULL) {
-		tzname[0] = tzname[1] = gmt;
-		return;
-	}
+    if (sp == NULL) {
+        tzname[0] = tzname[1] = gmt;
+        return;
+    }
 #endif /* defined ALL_STATE */
-	for (i = 0; i < sp->typecnt; ++i) {
-		register const struct ttinfo * const	ttisp = &sp->ttis[i];
+    for (i = 0; i < sp->typecnt; ++i) {
+        register const struct ttinfo * const    ttisp = &sp->ttis[i];
 
-		tzname[ttisp->tt_isdst] =
-			&sp->chars[ttisp->tt_abbrind];
+        tzname[ttisp->tt_isdst] =
+            &sp->chars[ttisp->tt_abbrind];
 #ifdef USG_COMPAT
-		if (ttisp->tt_isdst)
-			daylight = 1;
-		if (i == 0 || !ttisp->tt_isdst)
-			timezone = -(ttisp->tt_gmtoff);
+        if (ttisp->tt_isdst)
+            daylight = 1;
+        if (i == 0 || !ttisp->tt_isdst)
+            timezone = -(ttisp->tt_gmtoff);
 #endif /* defined USG_COMPAT */
 #ifdef ALTZONE
-		if (i == 0 || ttisp->tt_isdst)
-			altzone = -(ttisp->tt_gmtoff);
+        if (i == 0 || ttisp->tt_isdst)
+            altzone = -(ttisp->tt_gmtoff);
 #endif /* defined ALTZONE */
-	}
-	/*
-	** And to get the latest zone names into tzname. . .
-	*/
-	for (i = 0; i < sp->timecnt; ++i) {
-		register const struct ttinfo * const	ttisp =
-							&sp->ttis[
-								sp->types[i]];
+    }
+    /*
+    ** And to get the latest zone names into tzname. . .
+    */
+    for (i = 0; i < sp->timecnt; ++i) {
+        register const struct ttinfo * const    ttisp =
+                            &sp->ttis[
+                                sp->types[i]];
 
-		tzname[ttisp->tt_isdst] =
-			&sp->chars[ttisp->tt_abbrind];
-	}
-	/*
-	** Finally, scrub the abbreviations.
-	** First, replace bogus characters.
-	*/
-	for (i = 0; i < sp->charcnt; ++i)
-		if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL)
-			sp->chars[i] = TZ_ABBR_ERR_CHAR;
-	/*
-	** Second, truncate long abbreviations.
-	*/
-	for (i = 0; i < sp->typecnt; ++i) {
-		register const struct ttinfo * const	ttisp = &sp->ttis[i];
-		register char *				cp = &sp->chars[ttisp->tt_abbrind];
+        tzname[ttisp->tt_isdst] =
+            &sp->chars[ttisp->tt_abbrind];
+    }
+    /*
+    ** Finally, scrub the abbreviations.
+    ** First, replace bogus characters.
+    */
+    for (i = 0; i < sp->charcnt; ++i)
+        if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL)
+            sp->chars[i] = TZ_ABBR_ERR_CHAR;
+    /*
+    ** Second, truncate long abbreviations.
+    */
+    for (i = 0; i < sp->typecnt; ++i) {
+        register const struct ttinfo * const    ttisp = &sp->ttis[i];
+        register char *             cp = &sp->chars[ttisp->tt_abbrind];
 
-		if (strlen(cp) > TZ_ABBR_MAX_LEN &&
-			strcmp(cp, GRANDPARENTED) != 0)
-				*(cp + TZ_ABBR_MAX_LEN) = '\0';
-	}
+        if (strlen(cp) > TZ_ABBR_MAX_LEN &&
+            strcmp(cp, GRANDPARENTED) != 0)
+                *(cp + TZ_ABBR_MAX_LEN) = '\0';
+    }
 }
 
 static int
 differ_by_repeat(t1, t0)
-const time_t	t1;
-const time_t	t0;
+const time_t    t1;
+const time_t    t0;
 {
-	if (TYPE_INTEGRAL(time_t) &&
-		TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
-			return 0;
+    if (TYPE_INTEGRAL(time_t) &&
+        TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
+            return 0;
         return (t1 - t0) == SECSPERREPEAT;
 }
 
@@ -352,66 +373,66 @@
 
 static int
 tzload(name, sp, doextend)
-register const char *		name;
-register struct state * const	sp;
-register const int		doextend;
+register const char *       name;
+register struct state * const   sp;
+register const int      doextend;
 {
-	register const char *		p;
-	register int			i;
-	register int			fid;
-	register int			stored;
-	register int			nread;
-	union {
-		struct tzhead	tzhead;
-		char		buf[2 * sizeof(struct tzhead) +
-					2 * sizeof *sp +
-					4 * TZ_MAX_TIMES];
-	} u;
+    register const char *       p;
+    register int            i;
+    register int            fid;
+    register int            stored;
+    register int            nread;
+    union {
+        struct tzhead   tzhead;
+        char        buf[2 * sizeof(struct tzhead) +
+                    2 * sizeof *sp +
+                    4 * TZ_MAX_TIMES];
+    } u;
     int                     toread = sizeof u.buf;
 
         if (name == NULL && (name = TZDEFAULT) == NULL) {
                 XLOG(("tzload: null 'name' parameter\n" ));
                 return -1;
         }
-	{
-		register int	doaccess;
-		/*
-		** Section 4.9.1 of the C standard says that
-		** "FILENAME_MAX expands to an integral constant expression
-		** that is the size needed for an array of char large enough
-		** to hold the longest file name string that the implementation
-		** guarantees can be opened."
-		*/
-		char		fullname[FILENAME_MAX + 1];
-                char        *origname = (char*) name;
+    {
+        register int    doaccess;
+        /*
+        ** Section 4.9.1 of the C standard says that
+        ** "FILENAME_MAX expands to an integral constant expression
+        ** that is the size needed for an array of char large enough
+        ** to hold the longest file name string that the implementation
+        ** guarantees can be opened."
+        */
+        char        fullname[FILENAME_MAX + 1];
+        char        *origname = (char*) name;
 
-		if (name[0] == ':')
-			++name;
-		doaccess = name[0] == '/';
-		if (!doaccess) {
-                        if ((p = TZDIR) == NULL) {
-                                XLOG(("tzload: null TZDIR macro ?\n" ));
-				return -1;
-                        }
-                        if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) {
-                                XLOG(( "tzload: path too long: %s/%s\n", p, name ));
-				return -1;
-                        }
-			(void) strcpy(fullname, p);
-			(void) strcat(fullname, "/");
-			(void) strcat(fullname, name);
-			/*
-			** Set doaccess if '.' (as in "../") shows up in name.
-			*/
-			if (strchr(name, '.') != NULL)
-				doaccess = TRUE;
-			name = fullname;
-		}
-                if (doaccess && access(name, R_OK) != 0) {
-                        XLOG(( "tzload: could not find '%s'\n", name ));
-			return -1;
-                }
-		if ((fid = open(name, OPEN_MODE)) == -1) {
+        if (name[0] == ':')
+            ++name;
+        doaccess = name[0] == '/';
+        if (!doaccess) {
+            if ((p = TZDIR) == NULL) {
+                XLOG(("tzload: null TZDIR macro ?\n" ));
+                return -1;
+            }
+            if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) {
+                XLOG(( "tzload: path too long: %s/%s\n", p, name ));
+                return -1;
+            }
+            (void) strcpy(fullname, p);
+            (void) strcat(fullname, "/");
+            (void) strcat(fullname, name);
+            /*
+            ** Set doaccess if '.' (as in "../") shows up in name.
+            */
+            if (strchr(name, '.') != NULL)
+                doaccess = TRUE;
+            name = fullname;
+        }
+        if (doaccess && access(name, R_OK) != 0) {
+            XLOG(( "tzload: could not find '%s'\n", name ));
+            return -1;
+        }
+        if ((fid = open(name, OPEN_MODE)) == -1) {
             char buf[READLEN];
             char name[NAMELEN + 1];
             int fidix = open(INDEXFILE, OPEN_MODE);
@@ -453,197 +474,197 @@
                 return -1;
             }
         }
-	}
-	nread = read(fid, u.buf, toread);
+    }
+    nread = read(fid, u.buf, toread);
         if (close(fid) < 0 || nread <= 0) {
-                XLOG(( "tzload: could not read content of '%s'\n", DATAFILE ));
-		return -1;
+            XLOG(( "tzload: could not read content of '%s'\n", DATAFILE ));
+            return -1;
         }
-	for (stored = 4; stored <= 8; stored *= 2) {
-		int		ttisstdcnt;
-		int		ttisgmtcnt;
+    for (stored = 4; stored <= 8; stored *= 2) {
+        int     ttisstdcnt;
+        int     ttisgmtcnt;
 
-		ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
-		ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
-		sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
-		sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
-		sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
-		sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
-		p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
-		if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
-			sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
-			sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
-			sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
-			(ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
-			(ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
-				return -1;
-		if (nread - (p - u.buf) <
-			sp->timecnt * stored +		/* ats */
-			sp->timecnt +			/* types */
-			sp->typecnt * 6 +		/* ttinfos */
-			sp->charcnt +			/* chars */
-			sp->leapcnt * (stored + 4) +	/* lsinfos */
-			ttisstdcnt +			/* ttisstds */
-			ttisgmtcnt)			/* ttisgmts */
-				return -1;
-		for (i = 0; i < sp->timecnt; ++i) {
-			sp->ats[i] = (stored == 4) ?
-				detzcode(p) : detzcode64(p);
-			p += stored;
-		}
-		for (i = 0; i < sp->timecnt; ++i) {
-			sp->types[i] = (unsigned char) *p++;
-			if (sp->types[i] >= sp->typecnt)
-				return -1;
-		}
-		for (i = 0; i < sp->typecnt; ++i) {
-			register struct ttinfo *	ttisp;
+        ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
+        ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
+        sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
+        sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
+        sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
+        sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
+        p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
+        if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
+            sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
+            sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
+            sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
+            (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
+            (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
+                return -1;
+        if (nread - (p - u.buf) <
+            sp->timecnt * stored +      /* ats */
+            sp->timecnt +           /* types */
+            sp->typecnt * 6 +       /* ttinfos */
+            sp->charcnt +           /* chars */
+            sp->leapcnt * (stored + 4) +    /* lsinfos */
+            ttisstdcnt +            /* ttisstds */
+            ttisgmtcnt)         /* ttisgmts */
+                return -1;
+        for (i = 0; i < sp->timecnt; ++i) {
+            sp->ats[i] = (stored == 4) ?
+                detzcode(p) : detzcode64(p);
+            p += stored;
+        }
+        for (i = 0; i < sp->timecnt; ++i) {
+            sp->types[i] = (unsigned char) *p++;
+            if (sp->types[i] >= sp->typecnt)
+                return -1;
+        }
+        for (i = 0; i < sp->typecnt; ++i) {
+            register struct ttinfo *    ttisp;
 
-			ttisp = &sp->ttis[i];
-			ttisp->tt_gmtoff = detzcode(p);
-			p += 4;
-			ttisp->tt_isdst = (unsigned char) *p++;
-			if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
-				return -1;
-			ttisp->tt_abbrind = (unsigned char) *p++;
-			if (ttisp->tt_abbrind < 0 ||
-				ttisp->tt_abbrind > sp->charcnt)
-					return -1;
-		}
-		for (i = 0; i < sp->charcnt; ++i)
-			sp->chars[i] = *p++;
-		sp->chars[i] = '\0';	/* ensure '\0' at end */
-		for (i = 0; i < sp->leapcnt; ++i) {
-			register struct lsinfo *	lsisp;
+            ttisp = &sp->ttis[i];
+            ttisp->tt_gmtoff = detzcode(p);
+            p += 4;
+            ttisp->tt_isdst = (unsigned char) *p++;
+            if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
+                return -1;
+            ttisp->tt_abbrind = (unsigned char) *p++;
+            if (ttisp->tt_abbrind < 0 ||
+                ttisp->tt_abbrind > sp->charcnt)
+                    return -1;
+        }
+        for (i = 0; i < sp->charcnt; ++i)
+            sp->chars[i] = *p++;
+        sp->chars[i] = '\0';    /* ensure '\0' at end */
+        for (i = 0; i < sp->leapcnt; ++i) {
+            register struct lsinfo *    lsisp;
 
-			lsisp = &sp->lsis[i];
-			lsisp->ls_trans = (stored == 4) ?
-				detzcode(p) : detzcode64(p);
-			p += stored;
-			lsisp->ls_corr = detzcode(p);
-			p += 4;
-		}
-		for (i = 0; i < sp->typecnt; ++i) {
-			register struct ttinfo *	ttisp;
+            lsisp = &sp->lsis[i];
+            lsisp->ls_trans = (stored == 4) ?
+                detzcode(p) : detzcode64(p);
+            p += stored;
+            lsisp->ls_corr = detzcode(p);
+            p += 4;
+        }
+        for (i = 0; i < sp->typecnt; ++i) {
+            register struct ttinfo *    ttisp;
 
-			ttisp = &sp->ttis[i];
-			if (ttisstdcnt == 0)
-				ttisp->tt_ttisstd = FALSE;
-			else {
-				ttisp->tt_ttisstd = *p++;
-				if (ttisp->tt_ttisstd != TRUE &&
-					ttisp->tt_ttisstd != FALSE)
-						return -1;
-			}
-		}
-		for (i = 0; i < sp->typecnt; ++i) {
-			register struct ttinfo *	ttisp;
+            ttisp = &sp->ttis[i];
+            if (ttisstdcnt == 0)
+                ttisp->tt_ttisstd = FALSE;
+            else {
+                ttisp->tt_ttisstd = *p++;
+                if (ttisp->tt_ttisstd != TRUE &&
+                    ttisp->tt_ttisstd != FALSE)
+                        return -1;
+            }
+        }
+        for (i = 0; i < sp->typecnt; ++i) {
+            register struct ttinfo *    ttisp;
 
-			ttisp = &sp->ttis[i];
-			if (ttisgmtcnt == 0)
-				ttisp->tt_ttisgmt = FALSE;
-			else {
-				ttisp->tt_ttisgmt = *p++;
-				if (ttisp->tt_ttisgmt != TRUE &&
-					ttisp->tt_ttisgmt != FALSE)
-						return -1;
-			}
-		}
-		/*
-		** Out-of-sort ats should mean we're running on a
-		** signed time_t system but using a data file with
-		** unsigned values (or vice versa).
-		*/
-		for (i = 0; i < sp->timecnt - 2; ++i)
-			if (sp->ats[i] > sp->ats[i + 1]) {
-				++i;
-				if (TYPE_SIGNED(time_t)) {
-					/*
-					** Ignore the end (easy).
-					*/
-					sp->timecnt = i;
-				} else {
-					/*
-					** Ignore the beginning (harder).
-					*/
-					register int	j;
+            ttisp = &sp->ttis[i];
+            if (ttisgmtcnt == 0)
+                ttisp->tt_ttisgmt = FALSE;
+            else {
+                ttisp->tt_ttisgmt = *p++;
+                if (ttisp->tt_ttisgmt != TRUE &&
+                    ttisp->tt_ttisgmt != FALSE)
+                        return -1;
+            }
+        }
+        /*
+        ** Out-of-sort ats should mean we're running on a
+        ** signed time_t system but using a data file with
+        ** unsigned values (or vice versa).
+        */
+        for (i = 0; i < sp->timecnt - 2; ++i)
+            if (sp->ats[i] > sp->ats[i + 1]) {
+                ++i;
+                if (TYPE_SIGNED(time_t)) {
+                    /*
+                    ** Ignore the end (easy).
+                    */
+                    sp->timecnt = i;
+                } else {
+                    /*
+                    ** Ignore the beginning (harder).
+                    */
+                    register int    j;
 
-					for (j = 0; j + i < sp->timecnt; ++j) {
-						sp->ats[j] = sp->ats[j + i];
-						sp->types[j] = sp->types[j + i];
-					}
-					sp->timecnt = j;
-				}
-				break;
-			}
-		/*
-		** If this is an old file, we're done.
-		*/
-		if (u.tzhead.tzh_version[0] == '\0')
-			break;
-		nread -= p - u.buf;
-		for (i = 0; i < nread; ++i)
-			u.buf[i] = p[i];
-		/*
-		** If this is a narrow integer time_t system, we're done.
-		*/
-		if (stored >= (int) sizeof(time_t) && TYPE_INTEGRAL(time_t))
-			break;
-	}
-	if (doextend && nread > 2 &&
-		u.buf[0] == '\n' && u.buf[nread - 1] == '\n' &&
-		sp->typecnt + 2 <= TZ_MAX_TYPES) {
-			struct state	ts;
-			register int	result;
+                    for (j = 0; j + i < sp->timecnt; ++j) {
+                        sp->ats[j] = sp->ats[j + i];
+                        sp->types[j] = sp->types[j + i];
+                    }
+                    sp->timecnt = j;
+                }
+                break;
+            }
+        /*
+        ** If this is an old file, we're done.
+        */
+        if (u.tzhead.tzh_version[0] == '\0')
+            break;
+        nread -= p - u.buf;
+        for (i = 0; i < nread; ++i)
+            u.buf[i] = p[i];
+        /*
+        ** If this is a narrow integer time_t system, we're done.
+        */
+        if (stored >= (int) sizeof(time_t) && TYPE_INTEGRAL(time_t))
+            break;
+    }
+    if (doextend && nread > 2 &&
+        u.buf[0] == '\n' && u.buf[nread - 1] == '\n' &&
+        sp->typecnt + 2 <= TZ_MAX_TYPES) {
+            struct state    ts;
+            register int    result;
 
-			u.buf[nread - 1] = '\0';
-			result = tzparse(&u.buf[1], &ts, FALSE);
-			if (result == 0 && ts.typecnt == 2 &&
-				sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) {
-					for (i = 0; i < 2; ++i)
-						ts.ttis[i].tt_abbrind +=
-							sp->charcnt;
-					for (i = 0; i < ts.charcnt; ++i)
-						sp->chars[sp->charcnt++] =
-							ts.chars[i];
-					i = 0;
-					while (i < ts.timecnt &&
-						ts.ats[i] <=
-						sp->ats[sp->timecnt - 1])
-							++i;
-					while (i < ts.timecnt &&
-					    sp->timecnt < TZ_MAX_TIMES) {
-						sp->ats[sp->timecnt] =
-							ts.ats[i];
-						sp->types[sp->timecnt] =
-							sp->typecnt +
-							ts.types[i];
-						++sp->timecnt;
-						++i;
-					}
-					sp->ttis[sp->typecnt++] = ts.ttis[0];
-					sp->ttis[sp->typecnt++] = ts.ttis[1];
-			}
-	}
-	i = 2 * YEARSPERREPEAT;
-	sp->goback = sp->goahead = sp->timecnt > i;
-	sp->goback &= sp->types[i] == sp->types[0] &&
-		differ_by_repeat(sp->ats[i], sp->ats[0]);
-	sp->goahead &=
-		sp->types[sp->timecnt - 1] == sp->types[sp->timecnt - 1 - i] &&
-		differ_by_repeat(sp->ats[sp->timecnt - 1],
-			 sp->ats[sp->timecnt - 1 - i]);
+            u.buf[nread - 1] = '\0';
+            result = tzparse(&u.buf[1], &ts, FALSE);
+            if (result == 0 && ts.typecnt == 2 &&
+                sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) {
+                    for (i = 0; i < 2; ++i)
+                        ts.ttis[i].tt_abbrind +=
+                            sp->charcnt;
+                    for (i = 0; i < ts.charcnt; ++i)
+                        sp->chars[sp->charcnt++] =
+                            ts.chars[i];
+                    i = 0;
+                    while (i < ts.timecnt &&
+                        ts.ats[i] <=
+                        sp->ats[sp->timecnt - 1])
+                            ++i;
+                    while (i < ts.timecnt &&
+                        sp->timecnt < TZ_MAX_TIMES) {
+                        sp->ats[sp->timecnt] =
+                            ts.ats[i];
+                        sp->types[sp->timecnt] =
+                            sp->typecnt +
+                            ts.types[i];
+                        ++sp->timecnt;
+                        ++i;
+                    }
+                    sp->ttis[sp->typecnt++] = ts.ttis[0];
+                    sp->ttis[sp->typecnt++] = ts.ttis[1];
+            }
+    }
+    i = 2 * YEARSPERREPEAT;
+    sp->goback = sp->goahead = sp->timecnt > i;
+    sp->goback &= sp->types[i] == sp->types[0] &&
+        differ_by_repeat(sp->ats[i], sp->ats[0]);
+    sp->goahead &=
+        sp->types[sp->timecnt - 1] == sp->types[sp->timecnt - 1 - i] &&
+        differ_by_repeat(sp->ats[sp->timecnt - 1],
+             sp->ats[sp->timecnt - 1 - i]);
         XLOG(( "tzload: load ok !!\n" ));
-	return 0;
+    return 0;
 }
 
-static const int	mon_lengths[2][MONSPERYEAR] = {
-	{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-	{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+static const int    mon_lengths[2][MONSPERYEAR] = {
+    { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+    { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
 };
 
-static const int	year_lengths[2] = {
-	DAYSPERNYEAR, DAYSPERLYEAR
+static const int    year_lengths[2] = {
+    DAYSPERNYEAR, DAYSPERLYEAR
 };
 
 /*
@@ -654,14 +675,14 @@
 
 static const char *
 getzname(strp)
-register const char *	strp;
+register const char *   strp;
 {
-	register char	c;
+    register char   c;
 
-	while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
-		c != '+')
-			++strp;
-	return strp;
+    while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
+        c != '+')
+            ++strp;
+    return strp;
 }
 
 /*
@@ -676,11 +697,11 @@
 static const char *
 getqzname(register const char *strp, const int delim)
 {
-	register int	c;
+    register int    c;
 
-	while ((c = *strp) != '\0' && c != delim)
-		++strp;
-	return strp;
+    while ((c = *strp) != '\0' && c != delim)
+        ++strp;
+    return strp;
 }
 
 /*
@@ -692,27 +713,27 @@
 
 static const char *
 getnum(strp, nump, min, max)
-register const char *	strp;
-int * const		nump;
-const int		min;
-const int		max;
+register const char *   strp;
+int * const     nump;
+const int       min;
+const int       max;
 {
-	register char	c;
-	register int	num;
+    register char   c;
+    register int    num;
 
-	if (strp == NULL || !is_digit(c = *strp))
-		return NULL;
-	num = 0;
-	do {
-		num = num * 10 + (c - '0');
-		if (num > max)
-			return NULL;	/* illegal value */
-		c = *++strp;
-	} while (is_digit(c));
-	if (num < min)
-		return NULL;		/* illegal value */
-	*nump = num;
-	return strp;
+    if (strp == NULL || !is_digit(c = *strp))
+        return NULL;
+    num = 0;
+    do {
+        num = num * 10 + (c - '0');
+        if (num > max)
+            return NULL;    /* illegal value */
+        c = *++strp;
+    } while (is_digit(c));
+    if (num < min)
+        return NULL;        /* illegal value */
+    *nump = num;
+    return strp;
 }
 
 /*
@@ -725,37 +746,37 @@
 
 static const char *
 getsecs(strp, secsp)
-register const char *	strp;
-long * const		secsp;
+register const char *   strp;
+long * const        secsp;
 {
-	int	num;
+    int num;
 
-	/*
-	** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
-	** "M10.4.6/26", which does not conform to Posix,
-	** but which specifies the equivalent of
-	** ``02:00 on the first Sunday on or after 23 Oct''.
-	*/
-	strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
-	if (strp == NULL)
-		return NULL;
-	*secsp = num * (long) SECSPERHOUR;
-	if (*strp == ':') {
-		++strp;
-		strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
-		if (strp == NULL)
-			return NULL;
-		*secsp += num * SECSPERMIN;
-		if (*strp == ':') {
-			++strp;
-			/* `SECSPERMIN' allows for leap seconds. */
-			strp = getnum(strp, &num, 0, SECSPERMIN);
-			if (strp == NULL)
-				return NULL;
-			*secsp += num;
-		}
-	}
-	return strp;
+    /*
+    ** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
+    ** "M10.4.6/26", which does not conform to Posix,
+    ** but which specifies the equivalent of
+    ** ``02:00 on the first Sunday on or after 23 Oct''.
+    */
+    strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
+    if (strp == NULL)
+        return NULL;
+    *secsp = num * (long) SECSPERHOUR;
+    if (*strp == ':') {
+        ++strp;
+        strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
+        if (strp == NULL)
+            return NULL;
+        *secsp += num * SECSPERMIN;
+        if (*strp == ':') {
+            ++strp;
+            /* `SECSPERMIN' allows for leap seconds. */
+            strp = getnum(strp, &num, 0, SECSPERMIN);
+            if (strp == NULL)
+                return NULL;
+            *secsp += num;
+        }
+    }
+    return strp;
 }
 
 /*
@@ -767,22 +788,22 @@
 
 static const char *
 getoffset(strp, offsetp)
-register const char *	strp;
-long * const		offsetp;
+register const char *   strp;
+long * const        offsetp;
 {
-	register int	neg = 0;
+    register int    neg = 0;
 
-	if (*strp == '-') {
-		neg = 1;
-		++strp;
-	} else if (*strp == '+')
-		++strp;
-	strp = getsecs(strp, offsetp);
-	if (strp == NULL)
-		return NULL;		/* illegal time */
-	if (neg)
-		*offsetp = -*offsetp;
-	return strp;
+    if (*strp == '-') {
+        neg = 1;
+        ++strp;
+    } else if (*strp == '+')
+        ++strp;
+    strp = getsecs(strp, offsetp);
+    if (strp == NULL)
+        return NULL;        /* illegal time */
+    if (neg)
+        *offsetp = -*offsetp;
+    return strp;
 }
 
 /*
@@ -794,50 +815,50 @@
 
 static const char *
 getrule(strp, rulep)
-const char *			strp;
-register struct rule * const	rulep;
+const char *            strp;
+register struct rule * const    rulep;
 {
-	if (*strp == 'J') {
-		/*
-		** Julian day.
-		*/
-		rulep->r_type = JULIAN_DAY;
-		++strp;
-		strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
-	} else if (*strp == 'M') {
-		/*
-		** Month, week, day.
-		*/
-		rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
-		++strp;
-		strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
-		if (strp == NULL)
-			return NULL;
-		if (*strp++ != '.')
-			return NULL;
-		strp = getnum(strp, &rulep->r_week, 1, 5);
-		if (strp == NULL)
-			return NULL;
-		if (*strp++ != '.')
-			return NULL;
-		strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
-	} else if (is_digit(*strp)) {
-		/*
-		** Day of year.
-		*/
-		rulep->r_type = DAY_OF_YEAR;
-		strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
-	} else	return NULL;		/* invalid format */
-	if (strp == NULL)
-		return NULL;
-	if (*strp == '/') {
-		/*
-		** Time specified.
-		*/
-		++strp;
-		strp = getsecs(strp, &rulep->r_time);
-	} else	rulep->r_time = 2 * SECSPERHOUR;	/* default = 2:00:00 */
-	return strp;
+    if (*strp == 'J') {
+        /*
+        ** Julian day.
+        */
+        rulep->r_type = JULIAN_DAY;
+        ++strp;
+        strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
+    } else if (*strp == 'M') {
+        /*
+        ** Month, week, day.
+        */
+        rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
+        ++strp;
+        strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
+        if (strp == NULL)
+            return NULL;
+        if (*strp++ != '.')
+            return NULL;
+        strp = getnum(strp, &rulep->r_week, 1, 5);
+        if (strp == NULL)
+            return NULL;
+        if (*strp++ != '.')
+            return NULL;
+        strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
+    } else if (is_digit(*strp)) {
+        /*
+        ** Day of year.
+        */
+        rulep->r_type = DAY_OF_YEAR;
+        strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
+    } else  return NULL;        /* invalid format */
+    if (strp == NULL)
+        return NULL;
+    if (*strp == '/') {
+        /*
+        ** Time specified.
+        */
+        ++strp;
+        strp = getsecs(strp, &rulep->r_time);
+    } else  rulep->r_time = 2 * SECSPERHOUR;    /* default = 2:00:00 */
+    return strp;
 }
 
 /*
@@ -848,92 +869,92 @@
 
 static time_t
 transtime(janfirst, year, rulep, offset)
-const time_t				janfirst;
-const int				year;
-register const struct rule * const	rulep;
-const long				offset;
+const time_t                janfirst;
+const int               year;
+register const struct rule * const  rulep;
+const long              offset;
 {
-	register int	leapyear;
-	register time_t	value;
-	register int	i;
-	int		d, m1, yy0, yy1, yy2, dow;
+    register int    leapyear;
+    register time_t value;
+    register int    i;
+    int     d, m1, yy0, yy1, yy2, dow;
 
-	INITIALIZE(value);
-	leapyear = isleap(year);
-	switch (rulep->r_type) {
+    INITIALIZE(value);
+    leapyear = isleap(year);
+    switch (rulep->r_type) {
 
-	case JULIAN_DAY:
-		/*
-		** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
-		** years.
-		** In non-leap years, or if the day number is 59 or less, just
-		** add SECSPERDAY times the day number-1 to the time of
-		** January 1, midnight, to get the day.
-		*/
-		value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
-		if (leapyear && rulep->r_day >= 60)
-			value += SECSPERDAY;
-		break;
+    case JULIAN_DAY:
+        /*
+        ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
+        ** years.
+        ** In non-leap years, or if the day number is 59 or less, just
+        ** add SECSPERDAY times the day number-1 to the time of
+        ** January 1, midnight, to get the day.
+        */
+        value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
+        if (leapyear && rulep->r_day >= 60)
+            value += SECSPERDAY;
+        break;
 
-	case DAY_OF_YEAR:
-		/*
-		** n - day of year.
-		** Just add SECSPERDAY times the day number to the time of
-		** January 1, midnight, to get the day.
-		*/
-		value = janfirst + rulep->r_day * SECSPERDAY;
-		break;
+    case DAY_OF_YEAR:
+        /*
+        ** n - day of year.
+        ** Just add SECSPERDAY times the day number to the time of
+        ** January 1, midnight, to get the day.
+        */
+        value = janfirst + rulep->r_day * SECSPERDAY;
+        break;
 
-	case MONTH_NTH_DAY_OF_WEEK:
-		/*
-		** Mm.n.d - nth "dth day" of month m.
-		*/
-		value = janfirst;
-		for (i = 0; i < rulep->r_mon - 1; ++i)
-			value += mon_lengths[leapyear][i] * SECSPERDAY;
+    case MONTH_NTH_DAY_OF_WEEK:
+        /*
+        ** Mm.n.d - nth "dth day" of month m.
+        */
+        value = janfirst;
+        for (i = 0; i < rulep->r_mon - 1; ++i)
+            value += mon_lengths[leapyear][i] * SECSPERDAY;
 
-		/*
-		** Use Zeller's Congruence to get day-of-week of first day of
-		** month.
-		*/
-		m1 = (rulep->r_mon + 9) % 12 + 1;
-		yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
-		yy1 = yy0 / 100;
-		yy2 = yy0 % 100;
-		dow = ((26 * m1 - 2) / 10 +
-			1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
-		if (dow < 0)
-			dow += DAYSPERWEEK;
+        /*
+        ** Use Zeller's Congruence to get day-of-week of first day of
+        ** month.
+        */
+        m1 = (rulep->r_mon + 9) % 12 + 1;
+        yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
+        yy1 = yy0 / 100;
+        yy2 = yy0 % 100;
+        dow = ((26 * m1 - 2) / 10 +
+            1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
+        if (dow < 0)
+            dow += DAYSPERWEEK;
 
-		/*
-		** "dow" is the day-of-week of the first day of the month. Get
-		** the day-of-month (zero-origin) of the first "dow" day of the
-		** month.
-		*/
-		d = rulep->r_day - dow;
-		if (d < 0)
-			d += DAYSPERWEEK;
-		for (i = 1; i < rulep->r_week; ++i) {
-			if (d + DAYSPERWEEK >=
-				mon_lengths[leapyear][rulep->r_mon - 1])
-					break;
-			d += DAYSPERWEEK;
-		}
+        /*
+        ** "dow" is the day-of-week of the first day of the month. Get
+        ** the day-of-month (zero-origin) of the first "dow" day of the
+        ** month.
+        */
+        d = rulep->r_day - dow;
+        if (d < 0)
+            d += DAYSPERWEEK;
+        for (i = 1; i < rulep->r_week; ++i) {
+            if (d + DAYSPERWEEK >=
+                mon_lengths[leapyear][rulep->r_mon - 1])
+                    break;
+            d += DAYSPERWEEK;
+        }
 
-		/*
-		** "d" is the day-of-month (zero-origin) of the day we want.
-		*/
-		value += d * SECSPERDAY;
-		break;
-	}
+        /*
+        ** "d" is the day-of-month (zero-origin) of the day we want.
+        */
+        value += d * SECSPERDAY;
+        break;
+    }
 
-	/*
-	** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
-	** question. To get the Epoch-relative time of the specified local
-	** time on that day, add the transition time and the current offset
-	** from UTC.
-	*/
-	return value + rulep->r_time + offset;
+    /*
+    ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
+    ** question. To get the Epoch-relative time of the specified local
+    ** time on that day, add the transition time and the current offset
+    ** from UTC.
+    */
+    return value + rulep->r_time + offset;
 }
 
 /*
@@ -943,322 +964,323 @@
 
 static int
 tzparse(name, sp, lastditch)
-const char *			name;
-register struct state * const	sp;
-const int			lastditch;
+const char *            name;
+register struct state * const   sp;
+const int           lastditch;
 {
-	const char *			stdname;
-	const char *			dstname;
-	size_t				stdlen;
-	size_t				dstlen;
-	long				stdoffset;
-	long				dstoffset;
-	register time_t *		atp;
-	register unsigned char *	typep;
-	register char *			cp;
-	register int			load_result;
+    const char *            stdname;
+    const char *            dstname;
+    size_t              stdlen;
+    size_t              dstlen;
+    long                stdoffset;
+    long                dstoffset;
+    register time_t *       atp;
+    register unsigned char *    typep;
+    register char *         cp;
+    register int            load_result;
 
-	INITIALIZE(dstname);
-	stdname = name;
-	if (lastditch) {
-		stdlen = strlen(name);	/* length of standard zone name */
-		name += stdlen;
-		if (stdlen >= sizeof sp->chars)
-			stdlen = (sizeof sp->chars) - 1;
-		stdoffset = 0;
-	} else {
-		if (*name == '<') {
-			name++;
-			stdname = name;
-			name = getqzname(name, '>');
-			if (*name != '>')
-				return (-1);
-			stdlen = name - stdname;
-			name++;
-		} else {
-			name = getzname(name);
-			stdlen = name - stdname;
-		}
-		if (*name == '\0')
-			return -1;
-		name = getoffset(name, &stdoffset);
-		if (name == NULL)
-			return -1;
-	}
-	load_result = tzload(TZDEFRULES, sp, FALSE);
-	if (load_result != 0)
-		sp->leapcnt = 0;		/* so, we're off a little */
-	sp->timecnt = 0;
-	if (*name != '\0') {
-		if (*name == '<') {
-			dstname = ++name;
-			name = getqzname(name, '>');
-			if (*name != '>')
-				return -1;
-			dstlen = name - dstname;
-			name++;
-		} else {
-			dstname = name;
-			name = getzname(name);
-			dstlen = name - dstname; /* length of DST zone name */
-		}
-		if (*name != '\0' && *name != ',' && *name != ';') {
-			name = getoffset(name, &dstoffset);
-			if (name == NULL)
-				return -1;
-		} else	dstoffset = stdoffset - SECSPERHOUR;
-		if (*name == '\0' && load_result != 0)
-			name = TZDEFRULESTRING;
-		if (*name == ',' || *name == ';') {
-			struct rule	start;
-			struct rule	end;
-			register int	year;
-			register time_t	janfirst;
-			time_t		starttime;
-			time_t		endtime;
+    INITIALIZE(dstname);
+    stdname = name;
+    if (lastditch) {
+        stdlen = strlen(name);  /* length of standard zone name */
+        name += stdlen;
+        if (stdlen >= sizeof sp->chars)
+            stdlen = (sizeof sp->chars) - 1;
+        stdoffset = 0;
+    } else {
+        if (*name == '<') {
+            name++;
+            stdname = name;
+            name = getqzname(name, '>');
+            if (*name != '>')
+                return (-1);
+            stdlen = name - stdname;
+            name++;
+        } else {
+            name = getzname(name);
+            stdlen = name - stdname;
+        }
+        if (*name == '\0')
+            return -1;
+        name = getoffset(name, &stdoffset);
+        if (name == NULL)
+            return -1;
+    }
+    load_result = tzload(TZDEFRULES, sp, FALSE);
+    if (load_result != 0)
+        sp->leapcnt = 0;        /* so, we're off a little */
+    sp->timecnt = 0;
+    if (*name != '\0') {
+        if (*name == '<') {
+            dstname = ++name;
+            name = getqzname(name, '>');
+            if (*name != '>')
+                return -1;
+            dstlen = name - dstname;
+            name++;
+        } else {
+            dstname = name;
+            name = getzname(name);
+            dstlen = name - dstname; /* length of DST zone name */
+        }
+        if (*name != '\0' && *name != ',' && *name != ';') {
+            name = getoffset(name, &dstoffset);
+            if (name == NULL)
+                return -1;
+        } else  dstoffset = stdoffset - SECSPERHOUR;
+        if (*name == '\0' && load_result != 0)
+            name = TZDEFRULESTRING;
+        if (*name == ',' || *name == ';') {
+            struct rule start;
+            struct rule end;
+            register int    year;
+            register time_t janfirst;
+            time_t      starttime;
+            time_t      endtime;
 
-			++name;
-			if ((name = getrule(name, &start)) == NULL)
-				return -1;
-			if (*name++ != ',')
-				return -1;
-			if ((name = getrule(name, &end)) == NULL)
-				return -1;
-			if (*name != '\0')
-				return -1;
-			sp->typecnt = 2;	/* standard time and DST */
-			/*
-			** Two transitions per year, from EPOCH_YEAR forward.
-			*/
-			sp->ttis[0].tt_gmtoff = -dstoffset;
-			sp->ttis[0].tt_isdst = 1;
-			sp->ttis[0].tt_abbrind = stdlen + 1;
-			sp->ttis[1].tt_gmtoff = -stdoffset;
-			sp->ttis[1].tt_isdst = 0;
-			sp->ttis[1].tt_abbrind = 0;
-			atp = sp->ats;
-			typep = sp->types;
-			janfirst = 0;
-			for (year = EPOCH_YEAR;
-			    sp->timecnt + 2 <= TZ_MAX_TIMES;
-			    ++year) {
-			    	time_t	newfirst;
+            ++name;
+            if ((name = getrule(name, &start)) == NULL)
+                return -1;
+            if (*name++ != ',')
+                return -1;
+            if ((name = getrule(name, &end)) == NULL)
+                return -1;
+            if (*name != '\0')
+                return -1;
+            sp->typecnt = 2;    /* standard time and DST */
+            /*
+            ** Two transitions per year, from EPOCH_YEAR forward.
+            */
+            sp->ttis[0].tt_gmtoff = -dstoffset;
+            sp->ttis[0].tt_isdst = 1;
+            sp->ttis[0].tt_abbrind = stdlen + 1;
+            sp->ttis[1].tt_gmtoff = -stdoffset;
+            sp->ttis[1].tt_isdst = 0;
+            sp->ttis[1].tt_abbrind = 0;
+            atp = sp->ats;
+            typep = sp->types;
+            janfirst = 0;
+            for (year = EPOCH_YEAR;
+                sp->timecnt + 2 <= TZ_MAX_TIMES;
+                ++year) {
+                    time_t  newfirst;
 
-				starttime = transtime(janfirst, year, &start,
-					stdoffset);
-				endtime = transtime(janfirst, year, &end,
-					dstoffset);
-				if (starttime > endtime) {
-					*atp++ = endtime;
-					*typep++ = 1;	/* DST ends */
-					*atp++ = starttime;
-					*typep++ = 0;	/* DST begins */
-				} else {
-					*atp++ = starttime;
-					*typep++ = 0;	/* DST begins */
-					*atp++ = endtime;
-					*typep++ = 1;	/* DST ends */
-				}
-				sp->timecnt += 2;
-				newfirst = janfirst;
-				newfirst += year_lengths[isleap(year)] *
-					SECSPERDAY;
-				if (newfirst <= janfirst)
-					break;
-				janfirst = newfirst;
-			}
-		} else {
-			register long	theirstdoffset;
-			register long	theirdstoffset;
-			register long	theiroffset;
-			register int	isdst;
-			register int	i;
-			register int	j;
+                starttime = transtime(janfirst, year, &start,
+                    stdoffset);
+                endtime = transtime(janfirst, year, &end,
+                    dstoffset);
+                if (starttime > endtime) {
+                    *atp++ = endtime;
+                    *typep++ = 1;   /* DST ends */
+                    *atp++ = starttime;
+                    *typep++ = 0;   /* DST begins */
+                } else {
+                    *atp++ = starttime;
+                    *typep++ = 0;   /* DST begins */
+                    *atp++ = endtime;
+                    *typep++ = 1;   /* DST ends */
+                }
+                sp->timecnt += 2;
+                newfirst = janfirst;
+                newfirst += year_lengths[isleap(year)] *
+                    SECSPERDAY;
+                if (newfirst <= janfirst)
+                    break;
+                janfirst = newfirst;
+            }
+        } else {
+            register long   theirstdoffset;
+            register long   theirdstoffset;
+            register long   theiroffset;
+            register int    isdst;
+            register int    i;
+            register int    j;
 
-			if (*name != '\0')
-				return -1;
-			/*
-			** Initial values of theirstdoffset and theirdstoffset.
-			*/
-			theirstdoffset = 0;
-			for (i = 0; i < sp->timecnt; ++i) {
-				j = sp->types[i];
-				if (!sp->ttis[j].tt_isdst) {
-					theirstdoffset =
-						-sp->ttis[j].tt_gmtoff;
-					break;
-				}
-			}
-			theirdstoffset = 0;
-			for (i = 0; i < sp->timecnt; ++i) {
-				j = sp->types[i];
-				if (sp->ttis[j].tt_isdst) {
-					theirdstoffset =
-						-sp->ttis[j].tt_gmtoff;
-					break;
-				}
-			}
-			/*
-			** Initially we're assumed to be in standard time.
-			*/
-			isdst = FALSE;
-			theiroffset = theirstdoffset;
-			/*
-			** Now juggle transition times and types
-			** tracking offsets as you do.
-			*/
-			for (i = 0; i < sp->timecnt; ++i) {
-				j = sp->types[i];
-				sp->types[i] = sp->ttis[j].tt_isdst;
-				if (sp->ttis[j].tt_ttisgmt) {
-					/* No adjustment to transition time */
-				} else {
-					/*
-					** If summer time is in effect, and the
-					** transition time was not specified as
-					** standard time, add the summer time
-					** offset to the transition time;
-					** otherwise, add the standard time
-					** offset to the transition time.
-					*/
-					/*
-					** Transitions from DST to DDST
-					** will effectively disappear since
-					** POSIX provides for only one DST
-					** offset.
-					*/
-					if (isdst && !sp->ttis[j].tt_ttisstd) {
-						sp->ats[i] += dstoffset -
-							theirdstoffset;
-					} else {
-						sp->ats[i] += stdoffset -
-							theirstdoffset;
-					}
-				}
-				theiroffset = -sp->ttis[j].tt_gmtoff;
-				if (sp->ttis[j].tt_isdst)
-					theirdstoffset = theiroffset;
-				else	theirstdoffset = theiroffset;
-			}
-			/*
-			** Finally, fill in ttis.
-			** ttisstd and ttisgmt need not be handled.
-			*/
-			sp->ttis[0].tt_gmtoff = -stdoffset;
-			sp->ttis[0].tt_isdst = FALSE;
-			sp->ttis[0].tt_abbrind = 0;
-			sp->ttis[1].tt_gmtoff = -dstoffset;
-			sp->ttis[1].tt_isdst = TRUE;
-			sp->ttis[1].tt_abbrind = stdlen + 1;
-			sp->typecnt = 2;
-		}
-	} else {
-		dstlen = 0;
-		sp->typecnt = 1;		/* only standard time */
-		sp->timecnt = 0;
-		sp->ttis[0].tt_gmtoff = -stdoffset;
-		sp->ttis[0].tt_isdst = 0;
-		sp->ttis[0].tt_abbrind = 0;
-	}
-	sp->charcnt = stdlen + 1;
-	if (dstlen != 0)
-		sp->charcnt += dstlen + 1;
-	if ((size_t) sp->charcnt > sizeof sp->chars)
-		return -1;
-	cp = sp->chars;
-	(void) strncpy(cp, stdname, stdlen);
-	cp += stdlen;
-	*cp++ = '\0';
-	if (dstlen != 0) {
-		(void) strncpy(cp, dstname, dstlen);
-		*(cp + dstlen) = '\0';
-	}
-	return 0;
+            if (*name != '\0')
+                return -1;
+            /*
+            ** Initial values of theirstdoffset and theirdstoffset.
+            */
+            theirstdoffset = 0;
+            for (i = 0; i < sp->timecnt; ++i) {
+                j = sp->types[i];
+                if (!sp->ttis[j].tt_isdst) {
+                    theirstdoffset =
+                        -sp->ttis[j].tt_gmtoff;
+                    break;
+                }
+            }
+            theirdstoffset = 0;
+            for (i = 0; i < sp->timecnt; ++i) {
+                j = sp->types[i];
+                if (sp->ttis[j].tt_isdst) {
+                    theirdstoffset =
+                        -sp->ttis[j].tt_gmtoff;
+                    break;
+                }
+            }
+            /*
+            ** Initially we're assumed to be in standard time.
+            */
+            isdst = FALSE;
+            theiroffset = theirstdoffset;
+            /*
+            ** Now juggle transition times and types
+            ** tracking offsets as you do.
+            */
+            for (i = 0; i < sp->timecnt; ++i) {
+                j = sp->types[i];
+                sp->types[i] = sp->ttis[j].tt_isdst;
+                if (sp->ttis[j].tt_ttisgmt) {
+                    /* No adjustment to transition time */
+                } else {
+                    /*
+                    ** If summer time is in effect, and the
+                    ** transition time was not specified as
+                    ** standard time, add the summer time
+                    ** offset to the transition time;
+                    ** otherwise, add the standard time
+                    ** offset to the transition time.
+                    */
+                    /*
+                    ** Transitions from DST to DDST
+                    ** will effectively disappear since
+                    ** POSIX provides for only one DST
+                    ** offset.
+                    */
+                    if (isdst && !sp->ttis[j].tt_ttisstd) {
+                        sp->ats[i] += dstoffset -
+                            theirdstoffset;
+                    } else {
+                        sp->ats[i] += stdoffset -
+                            theirstdoffset;
+                    }
+                }
+                theiroffset = -sp->ttis[j].tt_gmtoff;
+                if (sp->ttis[j].tt_isdst)
+                    theirdstoffset = theiroffset;
+                else    theirstdoffset = theiroffset;
+            }
+            /*
+            ** Finally, fill in ttis.
+            ** ttisstd and ttisgmt need not be handled.
+            */
+            sp->ttis[0].tt_gmtoff = -stdoffset;
+            sp->ttis[0].tt_isdst = FALSE;
+            sp->ttis[0].tt_abbrind = 0;
+            sp->ttis[1].tt_gmtoff = -dstoffset;
+            sp->ttis[1].tt_isdst = TRUE;
+            sp->ttis[1].tt_abbrind = stdlen + 1;
+            sp->typecnt = 2;
+        }
+    } else {
+        dstlen = 0;
+        sp->typecnt = 1;        /* only standard time */
+        sp->timecnt = 0;
+        sp->ttis[0].tt_gmtoff = -stdoffset;
+        sp->ttis[0].tt_isdst = 0;
+        sp->ttis[0].tt_abbrind = 0;
+    }
+    sp->charcnt = stdlen + 1;
+    if (dstlen != 0)
+        sp->charcnt += dstlen + 1;
+    if ((size_t) sp->charcnt > sizeof sp->chars)
+        return -1;
+    cp = sp->chars;
+    (void) strncpy(cp, stdname, stdlen);
+    cp += stdlen;
+    *cp++ = '\0';
+    if (dstlen != 0) {
+        (void) strncpy(cp, dstname, dstlen);
+        *(cp + dstlen) = '\0';
+    }
+    return 0;
 }
 
 static void
 gmtload(sp)
-struct state * const	sp;
+struct state * const    sp;
 {
-	if (tzload(gmt, sp, TRUE) != 0)
-		(void) tzparse(gmt, sp, TRUE);
+    if (tzload(gmt, sp, TRUE) != 0)
+        (void) tzparse(gmt, sp, TRUE);
 }
 
-#ifndef STD_INSPIRED
-/*
-** A non-static declaration of tzsetwall in a system header file
-** may cause a warning about this upcoming static declaration...
-*/
-static
-#endif /* !defined STD_INSPIRED */
-void
+static void
 tzsetwall P((void))
 {
-	if (lcl_is_set < 0)
-		return;
-	lcl_is_set = -1;
+    if (lcl_is_set < 0)
+        return;
+    lcl_is_set = -1;
 
 #ifdef ALL_STATE
-	if (lclptr == NULL) {
-		lclptr = (struct state *) malloc(sizeof *lclptr);
-		if (lclptr == NULL) {
-			settzname();	/* all we can do */
-			return;
-		}
-	}
+    if (lclptr == NULL) {
+        lclptr = (struct state *) malloc(sizeof *lclptr);
+        if (lclptr == NULL) {
+            settzname();    /* all we can do */
+            return;
+        }
+    }
 #endif /* defined ALL_STATE */
-	if (tzload((char *) NULL, lclptr, TRUE) != 0)
-		gmtload(lclptr);
-	settzname();
+    if (tzload((char *) NULL, lclptr, TRUE) != 0)
+        gmtload(lclptr);
+    settzname();
+}
+
+static void
+tzset_locked P((void))
+{
+    register const char *   name = NULL;
+    static char buf[PROP_VALUE_MAX];
+
+    name = getenv("TZ");
+
+    // try the "persist.sys.timezone" system property first
+    if (name == NULL && __system_property_get("persist.sys.timezone", buf) > 0)
+        name = buf;
+
+    if (name == NULL) {
+        tzsetwall();
+        return;
+    }
+
+    if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0)
+        return;
+    lcl_is_set = strlen(name) < sizeof lcl_TZname;
+    if (lcl_is_set)
+        (void) strcpy(lcl_TZname, name);
+
+#ifdef ALL_STATE
+    if (lclptr == NULL) {
+        lclptr = (struct state *) malloc(sizeof *lclptr);
+        if (lclptr == NULL) {
+            settzname();    /* all we can do */
+            return;
+        }
+    }
+#endif /* defined ALL_STATE */
+    if (*name == '\0') {
+        /*
+        ** User wants it fast rather than right.
+        */
+        lclptr->leapcnt = 0;        /* so, we're off a little */
+        lclptr->timecnt = 0;
+        lclptr->typecnt = 0;
+        lclptr->ttis[0].tt_isdst = 0;
+        lclptr->ttis[0].tt_gmtoff = 0;
+        lclptr->ttis[0].tt_abbrind = 0;
+        (void) strcpy(lclptr->chars, gmt);
+    } else if (tzload(name, lclptr, TRUE) != 0)
+        if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
+            (void) gmtload(lclptr);
+    settzname();
 }
 
 void
 tzset P((void))
 {
-	register const char *	name = NULL;
-    static char buf[PROP_VALUE_MAX];
-
-	name = getenv("TZ");
-
-	// try the "persist.sys.timezone" system property first
-	if (name == NULL && __system_property_get("persist.sys.timezone", buf) > 0)
-	    name = buf;
-
-	if (name == NULL) {
-		tzsetwall();
-		return;
-	}
-
-	if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0)
-		return;
-	lcl_is_set = strlen(name) < sizeof lcl_TZname;
-	if (lcl_is_set)
-		(void) strcpy(lcl_TZname, name);
-
-#ifdef ALL_STATE
-	if (lclptr == NULL) {
-		lclptr = (struct state *) malloc(sizeof *lclptr);
-		if (lclptr == NULL) {
-			settzname();	/* all we can do */
-			return;
-		}
-	}
-#endif /* defined ALL_STATE */
-	if (*name == '\0') {
-		/*
-		** User wants it fast rather than right.
-		*/
-		lclptr->leapcnt = 0;		/* so, we're off a little */
-		lclptr->timecnt = 0;
-		lclptr->typecnt = 0;
-		lclptr->ttis[0].tt_isdst = 0;
-		lclptr->ttis[0].tt_gmtoff = 0;
-		lclptr->ttis[0].tt_abbrind = 0;
-		(void) strcpy(lclptr->chars, gmt);
-	} else if (tzload(name, lclptr, TRUE) != 0)
-		if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
-			(void) gmtload(lclptr);
-	settzname();
+    _tzLock();
+    tzset_locked();
+    _tzUnlock();
 }
 
 /*
@@ -1273,102 +1295,101 @@
 /*ARGSUSED*/
 static struct tm *
 localsub(timep, offset, tmp)
-const time_t * const	timep;
-const long		offset;
-struct tm * const	tmp;
+const time_t * const    timep;
+const long      offset;
+struct tm * const   tmp;
 {
-	register struct state *		sp;
-	register const struct ttinfo *	ttisp;
-	register int			i;
-	register struct tm *		result;
-	const time_t			t = *timep;
+    register struct state *     sp;
+    register const struct ttinfo *  ttisp;
+    register int            i;
+    register struct tm *        result;
+    const time_t            t = *timep;
 
-	sp = lclptr;
+    sp = lclptr;
 #ifdef ALL_STATE
-	if (sp == NULL)
-		return gmtsub(timep, offset, tmp);
+    if (sp == NULL)
+        return gmtsub(timep, offset, tmp);
 #endif /* defined ALL_STATE */
-	if ((sp->goback && t < sp->ats[0]) ||
-		(sp->goahead && t > sp->ats[sp->timecnt - 1])) {
-			time_t			newt = t;
-			register time_t		seconds;
-			register time_t		tcycles;
-			register int_fast64_t	icycles;
+    if ((sp->goback && t < sp->ats[0]) ||
+        (sp->goahead && t > sp->ats[sp->timecnt - 1])) {
+            time_t          newt = t;
+            register time_t     seconds;
+            register time_t     tcycles;
+            register int_fast64_t   icycles;
 
-			if (t < sp->ats[0])
-				seconds = sp->ats[0] - t;
-			else	seconds = t - sp->ats[sp->timecnt - 1];
-			--seconds;
-			tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR;
-			++tcycles;
-			icycles = tcycles;
-			if (tcycles - icycles >= 1 || icycles - tcycles >= 1)
-				return NULL;
-			seconds = icycles;
-			seconds *= YEARSPERREPEAT;
-			seconds *= AVGSECSPERYEAR;
-			if (t < sp->ats[0])
-				newt += seconds;
-			else	newt -= seconds;
-			if (newt < sp->ats[0] ||
-				newt > sp->ats[sp->timecnt - 1])
-					return NULL;	/* "cannot happen" */
-			result = localsub(&newt, offset, tmp);
-			if (result == tmp) {
-				register time_t	newy;
+            if (t < sp->ats[0])
+                seconds = sp->ats[0] - t;
+            else    seconds = t - sp->ats[sp->timecnt - 1];
+            --seconds;
+            tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR;
+            ++tcycles;
+            icycles = tcycles;
+            if (tcycles - icycles >= 1 || icycles - tcycles >= 1)
+                return NULL;
+            seconds = icycles;
+            seconds *= YEARSPERREPEAT;
+            seconds *= AVGSECSPERYEAR;
+            if (t < sp->ats[0])
+                newt += seconds;
+            else    newt -= seconds;
+            if (newt < sp->ats[0] ||
+                newt > sp->ats[sp->timecnt - 1])
+                    return NULL;    /* "cannot happen" */
+            result = localsub(&newt, offset, tmp);
+            if (result == tmp) {
+                register time_t newy;
 
-				newy = tmp->tm_year;
-				if (t < sp->ats[0])
-					newy -= icycles * YEARSPERREPEAT;
-				else	newy += icycles * YEARSPERREPEAT;
-				tmp->tm_year = newy;
-				if (tmp->tm_year != newy)
-					return NULL;
-			}
-			return result;
-	}
-	if (sp->timecnt == 0 || t < sp->ats[0]) {
-		i = 0;
-		while (sp->ttis[i].tt_isdst)
-			if (++i >= sp->typecnt) {
-				i = 0;
-				break;
-			}
-	} else {
-		register int	lo = 1;
-		register int	hi = sp->timecnt;
+                newy = tmp->tm_year;
+                if (t < sp->ats[0])
+                    newy -= icycles * YEARSPERREPEAT;
+                else    newy += icycles * YEARSPERREPEAT;
+                tmp->tm_year = newy;
+                if (tmp->tm_year != newy)
+                    return NULL;
+            }
+            return result;
+    }
+    if (sp->timecnt == 0 || t < sp->ats[0]) {
+        i = 0;
+        while (sp->ttis[i].tt_isdst)
+            if (++i >= sp->typecnt) {
+                i = 0;
+                break;
+            }
+    } else {
+        register int    lo = 1;
+        register int    hi = sp->timecnt;
 
-		while (lo < hi) {
-			register int	mid = (lo + hi) >> 1;
+        while (lo < hi) {
+            register int    mid = (lo + hi) >> 1;
 
-			if (t < sp->ats[mid])
-				hi = mid;
-			else	lo = mid + 1;
-		}
-		i = (int) sp->types[lo - 1];
-	}
-	ttisp = &sp->ttis[i];
-	/*
-	** To get (wrong) behavior that's compatible with System V Release 2.0
-	** you'd replace the statement below with
-	**	t += ttisp->tt_gmtoff;
-	**	timesub(&t, 0L, sp, tmp);
-	*/
-	result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
-	tmp->tm_isdst = ttisp->tt_isdst;
-	tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
+            if (t < sp->ats[mid])
+                hi = mid;
+            else    lo = mid + 1;
+        }
+        i = (int) sp->types[lo - 1];
+    }
+    ttisp = &sp->ttis[i];
+    /*
+    ** To get (wrong) behavior that's compatible with System V Release 2.0
+    ** you'd replace the statement below with
+    **  t += ttisp->tt_gmtoff;
+    **  timesub(&t, 0L, sp, tmp);
+    */
+    result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
+    tmp->tm_isdst = ttisp->tt_isdst;
+    tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
 #ifdef TM_ZONE
-	tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
+    tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
 #endif /* defined TM_ZONE */
-	return result;
+    return result;
 }
 
 struct tm *
 localtime(timep)
-const time_t * const	timep;
+const time_t * const    timep;
 {
-	tzset();
-	return localsub(timep, 0L, &tm);
+    return localtime_r(timep, &tmGlobal);
 }
 
 /*
@@ -1377,11 +1398,17 @@
 
 struct tm *
 localtime_r(timep, tmp)
-const time_t * const	timep;
-struct tm *		tmp;
+const time_t * const    timep;
+struct tm *     tmp;
 {
-        tzset();
-	return localsub(timep, 0L, tmp);
+    struct tm*  result;
+
+    _tzLock();
+    tzset_locked();
+    result = localsub(timep, 0L, tmp);
+    _tzUnlock();
+
+    return result;
 }
 
 /*
@@ -1390,48 +1417,48 @@
 
 static struct tm *
 gmtsub(timep, offset, tmp)
-const time_t * const	timep;
-const long		offset;
-struct tm * const	tmp;
+const time_t * const    timep;
+const long      offset;
+struct tm * const   tmp;
 {
-	register struct tm *	result;
+    register struct tm *    result;
 
-	if (!gmt_is_set) {
-		gmt_is_set = TRUE;
+    if (!gmt_is_set) {
+        gmt_is_set = TRUE;
 #ifdef ALL_STATE
-		gmtptr = (struct state *) malloc(sizeof *gmtptr);
-		if (gmtptr != NULL)
+        gmtptr = (struct state *) malloc(sizeof *gmtptr);
+        if (gmtptr != NULL)
 #endif /* defined ALL_STATE */
-			gmtload(gmtptr);
-	}
-	result = timesub(timep, offset, gmtptr, tmp);
+            gmtload(gmtptr);
+    }
+    result = timesub(timep, offset, gmtptr, tmp);
 #ifdef TM_ZONE
-	/*
-	** Could get fancy here and deliver something such as
-	** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
-	** but this is no time for a treasure hunt.
-	*/
-	if (offset != 0)
-		tmp->TM_ZONE = wildabbr;
-	else {
+    /*
+    ** Could get fancy here and deliver something such as
+    ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
+    ** but this is no time for a treasure hunt.
+    */
+    if (offset != 0)
+        tmp->TM_ZONE = wildabbr;
+    else {
 #ifdef ALL_STATE
-		if (gmtptr == NULL)
-			tmp->TM_ZONE = gmt;
-		else	tmp->TM_ZONE = gmtptr->chars;
+        if (gmtptr == NULL)
+            tmp->TM_ZONE = gmt;
+        else    tmp->TM_ZONE = gmtptr->chars;
 #endif /* defined ALL_STATE */
 #ifndef ALL_STATE
-		tmp->TM_ZONE = gmtptr->chars;
+        tmp->TM_ZONE = gmtptr->chars;
 #endif /* State Farm */
-	}
+    }
 #endif /* defined TM_ZONE */
-	return result;
+    return result;
 }
 
 struct tm *
 gmtime(timep)
-const time_t * const	timep;
+const time_t * const    timep;
 {
-	return gmtsub(timep, 0L, &tm);
+    return gmtime_r(timep, &tmGlobal);
 }
 
 /*
@@ -1440,20 +1467,26 @@
 
 struct tm *
 gmtime_r(timep, tmp)
-const time_t * const	timep;
-struct tm *		tmp;
+const time_t * const    timep;
+struct tm *     tmp;
 {
-	return gmtsub(timep, 0L, tmp);
+    struct tm*  result;
+
+    _tzLock();
+    result = gmtsub(timep, 0L, tmp);
+    _tzUnlock();
+
+    return result;
 }
 
 #ifdef STD_INSPIRED
 
 struct tm *
 offtime(timep, offset)
-const time_t * const	timep;
-const long		offset;
+const time_t * const    timep;
+const long      offset;
 {
-	return gmtsub(timep, offset, &tm);
+    return gmtsub(timep, offset, &tmGlobal);
 }
 
 #endif /* defined STD_INSPIRED */
@@ -1465,180 +1498,180 @@
 
 static int
 leaps_thru_end_of(y)
-register const int	y;
+register const int  y;
 {
-	return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
-		-(leaps_thru_end_of(-(y + 1)) + 1);
+    return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
+        -(leaps_thru_end_of(-(y + 1)) + 1);
 }
 
 static struct tm *
 timesub(timep, offset, sp, tmp)
-const time_t * const			timep;
-const long				offset;
-register const struct state * const	sp;
-register struct tm * const		tmp;
+const time_t * const            timep;
+const long              offset;
+register const struct state * const sp;
+register struct tm * const      tmp;
 {
-	register const struct lsinfo *	lp;
-	register time_t			tdays;
-	register int			idays;	/* unsigned would be so 2003 */
-	register long			rem;
-	int				y;
-	register const int *		ip;
-	register long			corr;
-	register int			hit;
-	register int			i;
+    register const struct lsinfo *  lp;
+    register time_t         tdays;
+    register int            idays;  /* unsigned would be so 2003 */
+    register long           rem;
+    int             y;
+    register const int *        ip;
+    register long           corr;
+    register int            hit;
+    register int            i;
 
-	corr = 0;
-	hit = 0;
+    corr = 0;
+    hit = 0;
 #ifdef ALL_STATE
-	i = (sp == NULL) ? 0 : sp->leapcnt;
+    i = (sp == NULL) ? 0 : sp->leapcnt;
 #endif /* defined ALL_STATE */
 #ifndef ALL_STATE
-	i = sp->leapcnt;
+    i = sp->leapcnt;
 #endif /* State Farm */
-	while (--i >= 0) {
-		lp = &sp->lsis[i];
-		if (*timep >= lp->ls_trans) {
-			if (*timep == lp->ls_trans) {
-				hit = ((i == 0 && lp->ls_corr > 0) ||
-					lp->ls_corr > sp->lsis[i - 1].ls_corr);
-				if (hit)
-					while (i > 0 &&
-						sp->lsis[i].ls_trans ==
-						sp->lsis[i - 1].ls_trans + 1 &&
-						sp->lsis[i].ls_corr ==
-						sp->lsis[i - 1].ls_corr + 1) {
-							++hit;
-							--i;
-					}
-			}
-			corr = lp->ls_corr;
-			break;
-		}
-	}
-	y = EPOCH_YEAR;
-	tdays = *timep / SECSPERDAY;
-	rem = *timep - tdays * SECSPERDAY;
-	while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
-		int		newy;
-		register time_t	tdelta;
-		register int	idelta;
-		register int	leapdays;
+    while (--i >= 0) {
+        lp = &sp->lsis[i];
+        if (*timep >= lp->ls_trans) {
+            if (*timep == lp->ls_trans) {
+                hit = ((i == 0 && lp->ls_corr > 0) ||
+                    lp->ls_corr > sp->lsis[i - 1].ls_corr);
+                if (hit)
+                    while (i > 0 &&
+                        sp->lsis[i].ls_trans ==
+                        sp->lsis[i - 1].ls_trans + 1 &&
+                        sp->lsis[i].ls_corr ==
+                        sp->lsis[i - 1].ls_corr + 1) {
+                            ++hit;
+                            --i;
+                    }
+            }
+            corr = lp->ls_corr;
+            break;
+        }
+    }
+    y = EPOCH_YEAR;
+    tdays = *timep / SECSPERDAY;
+    rem = *timep - tdays * SECSPERDAY;
+    while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
+        int     newy;
+        register time_t tdelta;
+        register int    idelta;
+        register int    leapdays;
 
-		tdelta = tdays / DAYSPERLYEAR;
-		idelta = tdelta;
-		if (tdelta - idelta >= 1 || idelta - tdelta >= 1)
-			return NULL;
-		if (idelta == 0)
-			idelta = (tdays < 0) ? -1 : 1;
-		newy = y;
-		if (increment_overflow(&newy, idelta))
-			return NULL;
-		leapdays = leaps_thru_end_of(newy - 1) -
-			leaps_thru_end_of(y - 1);
-		tdays -= ((time_t) newy - y) * DAYSPERNYEAR;
-		tdays -= leapdays;
-		y = newy;
-	}
-	{
-		register long	seconds;
+        tdelta = tdays / DAYSPERLYEAR;
+        idelta = tdelta;
+        if (tdelta - idelta >= 1 || idelta - tdelta >= 1)
+            return NULL;
+        if (idelta == 0)
+            idelta = (tdays < 0) ? -1 : 1;
+        newy = y;
+        if (increment_overflow(&newy, idelta))
+            return NULL;
+        leapdays = leaps_thru_end_of(newy - 1) -
+            leaps_thru_end_of(y - 1);
+        tdays -= ((time_t) newy - y) * DAYSPERNYEAR;
+        tdays -= leapdays;
+        y = newy;
+    }
+    {
+        register long   seconds;
 
-		seconds = tdays * SECSPERDAY + 0.5;
-		tdays = seconds / SECSPERDAY;
-		rem += seconds - tdays * SECSPERDAY;
-	}
-	/*
-	** Given the range, we can now fearlessly cast...
-	*/
-	idays = tdays;
-	rem += offset - corr;
-	while (rem < 0) {
-		rem += SECSPERDAY;
-		--idays;
-	}
-	while (rem >= SECSPERDAY) {
-		rem -= SECSPERDAY;
-		++idays;
-	}
-	while (idays < 0) {
-		if (increment_overflow(&y, -1))
-			return NULL;
-		idays += year_lengths[isleap(y)];
-	}
-	while (idays >= year_lengths[isleap(y)]) {
-		idays -= year_lengths[isleap(y)];
-		if (increment_overflow(&y, 1))
-			return NULL;
-	}
-	tmp->tm_year = y;
-	if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE))
-		return NULL;
-	tmp->tm_yday = idays;
-	/*
-	** The "extra" mods below avoid overflow problems.
-	*/
-	tmp->tm_wday = EPOCH_WDAY +
-		((y - EPOCH_YEAR) % DAYSPERWEEK) *
-		(DAYSPERNYEAR % DAYSPERWEEK) +
-		leaps_thru_end_of(y - 1) -
-		leaps_thru_end_of(EPOCH_YEAR - 1) +
-		idays;
-	tmp->tm_wday %= DAYSPERWEEK;
-	if (tmp->tm_wday < 0)
-		tmp->tm_wday += DAYSPERWEEK;
-	tmp->tm_hour = (int) (rem / SECSPERHOUR);
-	rem %= SECSPERHOUR;
-	tmp->tm_min = (int) (rem / SECSPERMIN);
-	/*
-	** A positive leap second requires a special
-	** representation. This uses "... ??:59:60" et seq.
-	*/
-	tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
-	ip = mon_lengths[isleap(y)];
-	for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
-		idays -= ip[tmp->tm_mon];
-	tmp->tm_mday = (int) (idays + 1);
-	tmp->tm_isdst = 0;
+        seconds = tdays * SECSPERDAY + 0.5;
+        tdays = seconds / SECSPERDAY;
+        rem += seconds - tdays * SECSPERDAY;
+    }
+    /*
+    ** Given the range, we can now fearlessly cast...
+    */
+    idays = tdays;
+    rem += offset - corr;
+    while (rem < 0) {
+        rem += SECSPERDAY;
+        --idays;
+    }
+    while (rem >= SECSPERDAY) {
+        rem -= SECSPERDAY;
+        ++idays;
+    }
+    while (idays < 0) {
+        if (increment_overflow(&y, -1))
+            return NULL;
+        idays += year_lengths[isleap(y)];
+    }
+    while (idays >= year_lengths[isleap(y)]) {
+        idays -= year_lengths[isleap(y)];
+        if (increment_overflow(&y, 1))
+            return NULL;
+    }
+    tmp->tm_year = y;
+    if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE))
+        return NULL;
+    tmp->tm_yday = idays;
+    /*
+    ** The "extra" mods below avoid overflow problems.
+    */
+    tmp->tm_wday = EPOCH_WDAY +
+        ((y - EPOCH_YEAR) % DAYSPERWEEK) *
+        (DAYSPERNYEAR % DAYSPERWEEK) +
+        leaps_thru_end_of(y - 1) -
+        leaps_thru_end_of(EPOCH_YEAR - 1) +
+        idays;
+    tmp->tm_wday %= DAYSPERWEEK;
+    if (tmp->tm_wday < 0)
+        tmp->tm_wday += DAYSPERWEEK;
+    tmp->tm_hour = (int) (rem / SECSPERHOUR);
+    rem %= SECSPERHOUR;
+    tmp->tm_min = (int) (rem / SECSPERMIN);
+    /*
+    ** A positive leap second requires a special
+    ** representation. This uses "... ??:59:60" et seq.
+    */
+    tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
+    ip = mon_lengths[isleap(y)];
+    for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
+        idays -= ip[tmp->tm_mon];
+    tmp->tm_mday = (int) (idays + 1);
+    tmp->tm_isdst = 0;
 #ifdef TM_GMTOFF
-	tmp->TM_GMTOFF = offset;
+    tmp->TM_GMTOFF = offset;
 #endif /* defined TM_GMTOFF */
-	return tmp;
+    return tmp;
 }
 
 char *
 ctime(timep)
-const time_t * const	timep;
+const time_t * const    timep;
 {
 /*
 ** Section 4.12.3.2 of X3.159-1989 requires that
-**	The ctime function converts the calendar time pointed to by timer
-**	to local time in the form of a string. It is equivalent to
-**		asctime(localtime(timer))
+**  The ctime function converts the calendar time pointed to by timer
+**  to local time in the form of a string. It is equivalent to
+**      asctime(localtime(timer))
 */
-	return asctime(localtime(timep));
+    return asctime(localtime(timep));
 }
 
 char *
 ctime_r(timep, buf)
-const time_t * const	timep;
-char *			buf;
+const time_t * const    timep;
+char *          buf;
 {
-	struct tm	mytm;
+    struct tm   mytm;
 
-	return asctime_r(localtime_r(timep, &mytm), buf);
+    return asctime_r(localtime_r(timep, &mytm), buf);
 }
 
 /*
 ** Adapted from code provided by Robert Elz, who writes:
-**	The "best" way to do mktime I think is based on an idea of Bob
-**	Kridle's (so its said...) from a long time ago.
-**	It does a binary search of the time_t space. Since time_t's are
-**	just 32 bits, its a max of 32 iterations (even at 64 bits it
-**	would still be very reasonable).
+**  The "best" way to do mktime I think is based on an idea of Bob
+**  Kridle's (so its said...) from a long time ago.
+**  It does a binary search of the time_t space. Since time_t's are
+**  just 32 bits, its a max of 32 iterations (even at 64 bits it
+**  would still be very reasonable).
 */
 
 #ifndef WRONG
-#define WRONG	(-1)
+#define WRONG   (-1)
 #endif /* !defined WRONG */
 
 /*
@@ -1647,56 +1680,56 @@
 
 static int
 increment_overflow(number, delta)
-int *	number;
-int	delta;
+int *   number;
+int delta;
 {
-	int	number0;
+    int number0;
 
-	number0 = *number;
-	*number += delta;
-	return (*number < number0) != (delta < 0);
+    number0 = *number;
+    *number += delta;
+    return (*number < number0) != (delta < 0);
 }
 
 static int
 long_increment_overflow(number, delta)
-long *	number;
-int	delta;
+long *  number;
+int delta;
 {
-	long	number0;
+    long    number0;
 
-	number0 = *number;
-	*number += delta;
-	return (*number < number0) != (delta < 0);
+    number0 = *number;
+    *number += delta;
+    return (*number < number0) != (delta < 0);
 }
 
 static int
 normalize_overflow(tensptr, unitsptr, base)
-int * const	tensptr;
-int * const	unitsptr;
-const int	base;
+int * const tensptr;
+int * const unitsptr;
+const int   base;
 {
-	register int	tensdelta;
+    register int    tensdelta;
 
-	tensdelta = (*unitsptr >= 0) ?
-		(*unitsptr / base) :
-		(-1 - (-1 - *unitsptr) / base);
-	*unitsptr -= tensdelta * base;
-	return increment_overflow(tensptr, tensdelta);
+    tensdelta = (*unitsptr >= 0) ?
+        (*unitsptr / base) :
+        (-1 - (-1 - *unitsptr) / base);
+    *unitsptr -= tensdelta * base;
+    return increment_overflow(tensptr, tensdelta);
 }
 
 static int
 long_normalize_overflow(tensptr, unitsptr, base)
-long * const	tensptr;
-int * const	unitsptr;
-const int	base;
+long * const    tensptr;
+int * const unitsptr;
+const int   base;
 {
-	register int	tensdelta;
+    register int    tensdelta;
 
-	tensdelta = (*unitsptr >= 0) ?
-		(*unitsptr / base) :
-		(-1 - (-1 - *unitsptr) / base);
-	*unitsptr -= tensdelta * base;
-	return long_increment_overflow(tensptr, tensdelta);
+    tensdelta = (*unitsptr >= 0) ?
+        (*unitsptr / base) :
+        (-1 - (-1 - *unitsptr) / base);
+    *unitsptr -= tensdelta * base;
+    return long_increment_overflow(tensptr, tensdelta);
 }
 
 static int
@@ -1704,333 +1737,349 @@
 register const struct tm * const atmp;
 register const struct tm * const btmp;
 {
-	register int	result;
+    register int    result;
 
-	if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
-		(result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
-		(result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
-		(result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
-		(result = (atmp->tm_min - btmp->tm_min)) == 0)
-			result = atmp->tm_sec - btmp->tm_sec;
-	return result;
+    if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
+        (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
+        (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
+        (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
+        (result = (atmp->tm_min - btmp->tm_min)) == 0)
+            result = atmp->tm_sec - btmp->tm_sec;
+    return result;
 }
 
 static time_t
 time2sub(tmp, funcp, offset, okayp, do_norm_secs)
-struct tm * const	tmp;
-struct tm * (* const	funcp) P((const time_t*, long, struct tm*));
-const long		offset;
-int * const		okayp;
-const int		do_norm_secs;
+struct tm * const   tmp;
+struct tm * (* const    funcp) P((const time_t*, long, struct tm*));
+const long      offset;
+int * const     okayp;
+const int       do_norm_secs;
 {
-	register const struct state *	sp;
-	register int			dir;
-	register int			i, j;
-	register int			saved_seconds;
-	register long			li;
-	register time_t			lo;
-	register time_t			hi;
-	long				y;
-	time_t				newt;
-	time_t				t;
-	struct tm			yourtm, mytm;
+    register const struct state *   sp;
+    register int            dir;
+    register int            i, j;
+    register int            saved_seconds;
+    register long           li;
+    register time_t         lo;
+    register time_t         hi;
+    long                y;
+    time_t              newt;
+    time_t              t;
+    struct tm           yourtm, mytm;
 
-	*okayp = FALSE;
-	yourtm = *tmp;
-	if (do_norm_secs) {
-		if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
-			SECSPERMIN))
-				return WRONG;
-	}
-	if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR))
-		return WRONG;
-	if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
-		return WRONG;
-	y = yourtm.tm_year;
-	if (long_normalize_overflow(&y, &yourtm.tm_mon, MONSPERYEAR))
-		return WRONG;
-	/*
-	** Turn y into an actual year number for now.
-	** It is converted back to an offset from TM_YEAR_BASE later.
-	*/
-	if (long_increment_overflow(&y, TM_YEAR_BASE))
-		return WRONG;
-	while (yourtm.tm_mday <= 0) {
-		if (long_increment_overflow(&y, -1))
-			return WRONG;
-		li = y + (1 < yourtm.tm_mon);
-		yourtm.tm_mday += year_lengths[isleap(li)];
-	}
-	while (yourtm.tm_mday > DAYSPERLYEAR) {
-		li = y + (1 < yourtm.tm_mon);
-		yourtm.tm_mday -= year_lengths[isleap(li)];
-		if (long_increment_overflow(&y, 1))
-			return WRONG;
-	}
-	for ( ; ; ) {
-		i = mon_lengths[isleap(y)][yourtm.tm_mon];
-		if (yourtm.tm_mday <= i)
-			break;
-		yourtm.tm_mday -= i;
-		if (++yourtm.tm_mon >= MONSPERYEAR) {
-			yourtm.tm_mon = 0;
-			if (long_increment_overflow(&y, 1))
-				return WRONG;
-		}
-	}
-	if (long_increment_overflow(&y, -TM_YEAR_BASE))
-		return WRONG;
-	yourtm.tm_year = y;
-	if (yourtm.tm_year != y)
-		return WRONG;
-	if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN)
-		saved_seconds = 0;
-	else if (y + TM_YEAR_BASE < EPOCH_YEAR) {
-		/*
-		** We can't set tm_sec to 0, because that might push the
-		** time below the minimum representable time.
-		** Set tm_sec to 59 instead.
-		** This assumes that the minimum representable time is
-		** not in the same minute that a leap second was deleted from,
-		** which is a safer assumption than using 58 would be.
-		*/
-		if (increment_overflow(&yourtm.tm_sec, 1 - SECSPERMIN))
-			return WRONG;
-		saved_seconds = yourtm.tm_sec;
-		yourtm.tm_sec = SECSPERMIN - 1;
-	} else {
-		saved_seconds = yourtm.tm_sec;
-		yourtm.tm_sec = 0;
-	}
-	/*
-	** Do a binary search (this works whatever time_t's type is).
-	*/
-	if (!TYPE_SIGNED(time_t)) {
-		lo = 0;
-		hi = lo - 1;
-	} else if (!TYPE_INTEGRAL(time_t)) {
-		if (sizeof(time_t) > sizeof(float))
-			hi = (time_t) DBL_MAX;
-		else	hi = (time_t) FLT_MAX;
-		lo = -hi;
-	} else {
-		lo = 1;
-		for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i)
-			lo *= 2;
-		hi = -(lo + 1);
-	}
-	for ( ; ; ) {
-		t = lo / 2 + hi / 2;
-		if (t < lo)
-			t = lo;
-		else if (t > hi)
-			t = hi;
-		if ((*funcp)(&t, offset, &mytm) == NULL) {
-			/*
-			** Assume that t is too extreme to be represented in
-			** a struct tm; arrange things so that it is less
-			** extreme on the next pass.
-			*/
-			dir = (t > 0) ? 1 : -1;
-		} else	dir = tmcomp(&mytm, &yourtm);
-		if (dir != 0) {
-			if (t == lo) {
-				++t;
-				if (t <= lo)
-					return WRONG;
-				++lo;
-			} else if (t == hi) {
-				--t;
-				if (t >= hi)
-					return WRONG;
-				--hi;
-			}
-			if (lo > hi)
-				return WRONG;
-			if (dir > 0)
-				hi = t;
-			else	lo = t;
-			continue;
-		}
-		if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
-			break;
-		/*
-		** Right time, wrong type.
-		** Hunt for right time, right type.
-		** It's okay to guess wrong since the guess
-		** gets checked.
-		*/
-		/*
-		** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
-		*/
-		sp = (const struct state *)
-			(((void *) funcp == (void *) localsub) ?
-			lclptr : gmtptr);
+    *okayp = FALSE;
+    yourtm = *tmp;
+    if (do_norm_secs) {
+        if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
+            SECSPERMIN))
+                return WRONG;
+    }
+    if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR))
+        return WRONG;
+    if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
+        return WRONG;
+    y = yourtm.tm_year;
+    if (long_normalize_overflow(&y, &yourtm.tm_mon, MONSPERYEAR))
+        return WRONG;
+    /*
+    ** Turn y into an actual year number for now.
+    ** It is converted back to an offset from TM_YEAR_BASE later.
+    */
+    if (long_increment_overflow(&y, TM_YEAR_BASE))
+        return WRONG;
+    while (yourtm.tm_mday <= 0) {
+        if (long_increment_overflow(&y, -1))
+            return WRONG;
+        li = y + (1 < yourtm.tm_mon);
+        yourtm.tm_mday += year_lengths[isleap(li)];
+    }
+    while (yourtm.tm_mday > DAYSPERLYEAR) {
+        li = y + (1 < yourtm.tm_mon);
+        yourtm.tm_mday -= year_lengths[isleap(li)];
+        if (long_increment_overflow(&y, 1))
+            return WRONG;
+    }
+    for ( ; ; ) {
+        i = mon_lengths[isleap(y)][yourtm.tm_mon];
+        if (yourtm.tm_mday <= i)
+            break;
+        yourtm.tm_mday -= i;
+        if (++yourtm.tm_mon >= MONSPERYEAR) {
+            yourtm.tm_mon = 0;
+            if (long_increment_overflow(&y, 1))
+                return WRONG;
+        }
+    }
+    if (long_increment_overflow(&y, -TM_YEAR_BASE))
+        return WRONG;
+    yourtm.tm_year = y;
+    if (yourtm.tm_year != y)
+        return WRONG;
+    if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN)
+        saved_seconds = 0;
+    else if (y + TM_YEAR_BASE < EPOCH_YEAR) {
+        /*
+        ** We can't set tm_sec to 0, because that might push the
+        ** time below the minimum representable time.
+        ** Set tm_sec to 59 instead.
+        ** This assumes that the minimum representable time is
+        ** not in the same minute that a leap second was deleted from,
+        ** which is a safer assumption than using 58 would be.
+        */
+        if (increment_overflow(&yourtm.tm_sec, 1 - SECSPERMIN))
+            return WRONG;
+        saved_seconds = yourtm.tm_sec;
+        yourtm.tm_sec = SECSPERMIN - 1;
+    } else {
+        saved_seconds = yourtm.tm_sec;
+        yourtm.tm_sec = 0;
+    }
+    /*
+    ** Do a binary search (this works whatever time_t's type is).
+    */
+    if (!TYPE_SIGNED(time_t)) {
+        lo = 0;
+        hi = lo - 1;
+    } else if (!TYPE_INTEGRAL(time_t)) {
+        if (sizeof(time_t) > sizeof(float))
+            hi = (time_t) DBL_MAX;
+        else    hi = (time_t) FLT_MAX;
+        lo = -hi;
+    } else {
+        lo = 1;
+        for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i)
+            lo *= 2;
+        hi = -(lo + 1);
+    }
+    for ( ; ; ) {
+        t = lo / 2 + hi / 2;
+        if (t < lo)
+            t = lo;
+        else if (t > hi)
+            t = hi;
+        if ((*funcp)(&t, offset, &mytm) == NULL) {
+            /*
+            ** Assume that t is too extreme to be represented in
+            ** a struct tm; arrange things so that it is less
+            ** extreme on the next pass.
+            */
+            dir = (t > 0) ? 1 : -1;
+        } else  dir = tmcomp(&mytm, &yourtm);
+        if (dir != 0) {
+            if (t == lo) {
+                ++t;
+                if (t <= lo)
+                    return WRONG;
+                ++lo;
+            } else if (t == hi) {
+                --t;
+                if (t >= hi)
+                    return WRONG;
+                --hi;
+            }
+            if (lo > hi)
+                return WRONG;
+            if (dir > 0)
+                hi = t;
+            else    lo = t;
+            continue;
+        }
+        if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
+            break;
+        /*
+        ** Right time, wrong type.
+        ** Hunt for right time, right type.
+        ** It's okay to guess wrong since the guess
+        ** gets checked.
+        */
+        /*
+        ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
+        */
+        sp = (const struct state *)
+            (((void *) funcp == (void *) localsub) ?
+            lclptr : gmtptr);
 #ifdef ALL_STATE
-		if (sp == NULL)
-			return WRONG;
+        if (sp == NULL)
+            return WRONG;
 #endif /* defined ALL_STATE */
-		for (i = sp->typecnt - 1; i >= 0; --i) {
-			if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
-				continue;
-			for (j = sp->typecnt - 1; j >= 0; --j) {
-				if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
-					continue;
-				newt = t + sp->ttis[j].tt_gmtoff -
-					sp->ttis[i].tt_gmtoff;
-				if ((*funcp)(&newt, offset, &mytm) == NULL)
-					continue;
-				if (tmcomp(&mytm, &yourtm) != 0)
-					continue;
-				if (mytm.tm_isdst != yourtm.tm_isdst)
-					continue;
-				/*
-				** We have a match.
-				*/
-				t = newt;
-				goto label;
-			}
-		}
-		return WRONG;
-	}
+        for (i = sp->typecnt - 1; i >= 0; --i) {
+            if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
+                continue;
+            for (j = sp->typecnt - 1; j >= 0; --j) {
+                if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
+                    continue;
+                newt = t + sp->ttis[j].tt_gmtoff -
+                    sp->ttis[i].tt_gmtoff;
+                if ((*funcp)(&newt, offset, &mytm) == NULL)
+                    continue;
+                if (tmcomp(&mytm, &yourtm) != 0)
+                    continue;
+                if (mytm.tm_isdst != yourtm.tm_isdst)
+                    continue;
+                /*
+                ** We have a match.
+                */
+                t = newt;
+                goto label;
+            }
+        }
+        return WRONG;
+    }
 label:
-	newt = t + saved_seconds;
-	if ((newt < t) != (saved_seconds < 0))
-		return WRONG;
-	t = newt;
-	if ((*funcp)(&t, offset, tmp))
-		*okayp = TRUE;
-	return t;
+    newt = t + saved_seconds;
+    if ((newt < t) != (saved_seconds < 0))
+        return WRONG;
+    t = newt;
+    if ((*funcp)(&t, offset, tmp))
+        *okayp = TRUE;
+    return t;
 }
 
 static time_t
 time2(tmp, funcp, offset, okayp)
-struct tm * const	tmp;
-struct tm * (* const	funcp) P((const time_t*, long, struct tm*));
-const long		offset;
-int * const		okayp;
+struct tm * const   tmp;
+struct tm * (* const    funcp) P((const time_t*, long, struct tm*));
+const long      offset;
+int * const     okayp;
 {
-	time_t	t;
+    time_t  t;
 
-	/*
-	** First try without normalization of seconds
-	** (in case tm_sec contains a value associated with a leap second).
-	** If that fails, try with normalization of seconds.
-	*/
-	t = time2sub(tmp, funcp, offset, okayp, FALSE);
-	return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
+    /*
+    ** First try without normalization of seconds
+    ** (in case tm_sec contains a value associated with a leap second).
+    ** If that fails, try with normalization of seconds.
+    */
+    t = time2sub(tmp, funcp, offset, okayp, FALSE);
+    return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
 }
 
 static time_t
 time1(tmp, funcp, offset)
-struct tm * const	tmp;
-struct tm * (* const	funcp) P((const time_t *, long, struct tm *));
-const long		offset;
+struct tm * const   tmp;
+struct tm * (* const    funcp) P((const time_t *, long, struct tm *));
+const long      offset;
 {
-	register time_t			t;
-	register const struct state *	sp;
-	register int			samei, otheri;
-	register int			sameind, otherind;
-	register int			i;
-	register int			nseen;
-	int				seen[TZ_MAX_TYPES];
-	int				types[TZ_MAX_TYPES];
-	int				okay;
+    register time_t         t;
+    register const struct state *   sp;
+    register int            samei, otheri;
+    register int            sameind, otherind;
+    register int            i;
+    register int            nseen;
+    int             seen[TZ_MAX_TYPES];
+    int             types[TZ_MAX_TYPES];
+    int             okay;
 
-	if (tmp->tm_isdst > 1)
-		tmp->tm_isdst = 1;
-	t = time2(tmp, funcp, offset, &okay);
+    if (tmp->tm_isdst > 1)
+        tmp->tm_isdst = 1;
+    t = time2(tmp, funcp, offset, &okay);
 #ifdef PCTS
-	/*
-	** PCTS code courtesy Grant Sullivan.
-	*/
-	if (okay)
-		return t;
-	if (tmp->tm_isdst < 0)
-		tmp->tm_isdst = 0;	/* reset to std and try again */
+    /*
+    ** PCTS code courtesy Grant Sullivan.
+    */
+    if (okay)
+        return t;
+    if (tmp->tm_isdst < 0)
+        tmp->tm_isdst = 0;  /* reset to std and try again */
 #endif /* defined PCTS */
 #ifndef PCTS
-	if (okay || tmp->tm_isdst < 0)
-		return t;
+    if (okay || tmp->tm_isdst < 0)
+        return t;
 #endif /* !defined PCTS */
-	/*
-	** We're supposed to assume that somebody took a time of one type
-	** and did some math on it that yielded a "struct tm" that's bad.
-	** We try to divine the type they started from and adjust to the
-	** type they need.
-	*/
-	/*
-	** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
-	*/
-	sp = (const struct state *) (((void *) funcp == (void *) localsub) ?
-		lclptr : gmtptr);
+    /*
+    ** We're supposed to assume that somebody took a time of one type
+    ** and did some math on it that yielded a "struct tm" that's bad.
+    ** We try to divine the type they started from and adjust to the
+    ** type they need.
+    */
+    /*
+    ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
+    */
+    sp = (const struct state *) (((void *) funcp == (void *) localsub) ?
+        lclptr : gmtptr);
 #ifdef ALL_STATE
-	if (sp == NULL)
-		return WRONG;
+    if (sp == NULL)
+        return WRONG;
 #endif /* defined ALL_STATE */
-	for (i = 0; i < sp->typecnt; ++i)
-		seen[i] = FALSE;
-	nseen = 0;
-	for (i = sp->timecnt - 1; i >= 0; --i)
-		if (!seen[sp->types[i]]) {
-			seen[sp->types[i]] = TRUE;
-			types[nseen++] = sp->types[i];
-		}
-	for (sameind = 0; sameind < nseen; ++sameind) {
-		samei = types[sameind];
-		if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
-			continue;
-		for (otherind = 0; otherind < nseen; ++otherind) {
-			otheri = types[otherind];
-			if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
-				continue;
-			tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
-					sp->ttis[samei].tt_gmtoff;
-			tmp->tm_isdst = !tmp->tm_isdst;
-			t = time2(tmp, funcp, offset, &okay);
-			if (okay)
-				return t;
-			tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
-					sp->ttis[samei].tt_gmtoff;
-			tmp->tm_isdst = !tmp->tm_isdst;
-		}
-	}
-	return WRONG;
+    for (i = 0; i < sp->typecnt; ++i)
+        seen[i] = FALSE;
+    nseen = 0;
+    for (i = sp->timecnt - 1; i >= 0; --i)
+        if (!seen[sp->types[i]]) {
+            seen[sp->types[i]] = TRUE;
+            types[nseen++] = sp->types[i];
+        }
+    for (sameind = 0; sameind < nseen; ++sameind) {
+        samei = types[sameind];
+        if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
+            continue;
+        for (otherind = 0; otherind < nseen; ++otherind) {
+            otheri = types[otherind];
+            if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
+                continue;
+            tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
+                    sp->ttis[samei].tt_gmtoff;
+            tmp->tm_isdst = !tmp->tm_isdst;
+            t = time2(tmp, funcp, offset, &okay);
+            if (okay)
+                return t;
+            tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
+                    sp->ttis[samei].tt_gmtoff;
+            tmp->tm_isdst = !tmp->tm_isdst;
+        }
+    }
+    return WRONG;
 }
 
 time_t
 mktime(tmp)
-struct tm * const	tmp;
+struct tm * const   tmp;
 {
-	tzset();
-	return time1(tmp, localsub, 0L);
+    time_t  result;
+    _tzLock();
+    tzset_locked();
+    result = time1(tmp, localsub, 0L);
+    _tzUnlock();
+    return result;
 }
 
 #ifdef STD_INSPIRED
 
 time_t
 timelocal(tmp)
-struct tm * const	tmp;
+struct tm * const   tmp;
 {
-	tmp->tm_isdst = -1;	/* in case it wasn't initialized */
-	return mktime(tmp);
+    tmp->tm_isdst = -1; /* in case it wasn't initialized */
+    return mktime(tmp);
 }
 
 time_t
 timegm(tmp)
-struct tm * const	tmp;
+struct tm * const   tmp;
 {
-	tmp->tm_isdst = 0;
-	return time1(tmp, gmtsub, 0L);
+    time_t  result;
+
+    tmp->tm_isdst = 0;
+    _tzLock();
+    result = time1(tmp, gmtsub, 0L);
+    _tzUnlock();
+
+    return result;
 }
 
 time_t
 timeoff(tmp, offset)
-struct tm * const	tmp;
-const long		offset;
+struct tm * const   tmp;
+const long      offset;
 {
-	tmp->tm_isdst = 0;
-	return time1(tmp, gmtsub, offset);
+    time_t  result;
+
+    tmp->tm_isdst = 0;
+    _tzLock();
+    result = time1(tmp, gmtsub, offset);
+    _tzUnlock();
+
+    return result;
 }
 
 #endif /* defined STD_INSPIRED */
@@ -2044,13 +2093,13 @@
 
 long
 gtime(tmp)
-struct tm * const	tmp;
+struct tm * const   tmp;
 {
-	const time_t	t = mktime(tmp);
+    const time_t    t = mktime(tmp);
 
-	if (t == WRONG)
-		return -1;
-	return t;
+    if (t == WRONG)
+        return -1;
+    return t;
 }
 
 #endif /* defined CMUCS */
@@ -2071,62 +2120,62 @@
 
 static long
 leapcorr(timep)
-time_t *	timep;
+time_t *    timep;
 {
-	register struct state *		sp;
-	register struct lsinfo *	lp;
-	register int			i;
+    register struct state *     sp;
+    register struct lsinfo *    lp;
+    register int            i;
 
-	sp = lclptr;
-	i = sp->leapcnt;
-	while (--i >= 0) {
-		lp = &sp->lsis[i];
-		if (*timep >= lp->ls_trans)
-			return lp->ls_corr;
-	}
-	return 0;
+    sp = lclptr;
+    i = sp->leapcnt;
+    while (--i >= 0) {
+        lp = &sp->lsis[i];
+        if (*timep >= lp->ls_trans)
+            return lp->ls_corr;
+    }
+    return 0;
 }
 
 time_t
 time2posix(t)
-time_t	t;
+time_t  t;
 {
-	tzset();
-	return t - leapcorr(&t);
+    tzset();
+    return t - leapcorr(&t);
 }
 
 time_t
 posix2time(t)
-time_t	t;
+time_t  t;
 {
-	time_t	x;
-	time_t	y;
+    time_t  x;
+    time_t  y;
 
-	tzset();
-	/*
-	** For a positive leap second hit, the result
-	** is not unique. For a negative leap second
-	** hit, the corresponding time doesn't exist,
-	** so we return an adjacent second.
-	*/
-	x = t + leapcorr(&t);
-	y = x - leapcorr(&x);
-	if (y < t) {
-		do {
-			x++;
-			y = x - leapcorr(&x);
-		} while (y < t);
-		if (t != y)
-			return x - 1;
-	} else if (y > t) {
-		do {
-			--x;
-			y = x - leapcorr(&x);
-		} while (y > t);
-		if (t != y)
-			return x + 1;
-	}
-	return x;
+    tzset();
+    /*
+    ** For a positive leap second hit, the result
+    ** is not unique. For a negative leap second
+    ** hit, the corresponding time doesn't exist,
+    ** so we return an adjacent second.
+    */
+    x = t + leapcorr(&t);
+    y = x - leapcorr(&x);
+    if (y < t) {
+        do {
+            x++;
+            y = x - leapcorr(&x);
+        } while (y < t);
+        if (t != y)
+            return x - 1;
+    } else if (y > t) {
+        do {
+            --x;
+            y = x - leapcorr(&x);
+        } while (y > t);
+        if (t != y)
+            return x + 1;
+    }
+    return x;
 }
 
 #endif /* defined STD_INSPIRED */
diff --git a/libc/tzcode/private.h b/libc/tzcode/private.h
index 2837b70..e82a655 100644
--- a/libc/tzcode/private.h
+++ b/libc/tzcode/private.h
@@ -21,11 +21,11 @@
 
 #ifndef lint
 #ifndef NOID
-static char	privatehid[] = "@(#)private.h	8.2";
+static char privatehid[] = "@(#)private.h   8.2";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
-#define GRANDPARENTED	"Local time zone must be set--see zic manual page"
+#define GRANDPARENTED   "Local time zone must be set--see zic manual page"
 
 /*
 ** Defaults for preprocessor symbols.
@@ -33,49 +33,45 @@
 */
 
 #ifndef HAVE_ADJTIME
-#define HAVE_ADJTIME		1
+#define HAVE_ADJTIME        1
 #endif /* !defined HAVE_ADJTIME */
 
 #ifndef HAVE_GETTEXT
-#define HAVE_GETTEXT		0
+#define HAVE_GETTEXT        0
 #endif /* !defined HAVE_GETTEXT */
 
 #ifndef HAVE_INCOMPATIBLE_CTIME_R
-#define HAVE_INCOMPATIBLE_CTIME_R	0
+#define HAVE_INCOMPATIBLE_CTIME_R   0
 #endif /* !defined INCOMPATIBLE_CTIME_R */
 
 #ifndef HAVE_SETTIMEOFDAY
-#define HAVE_SETTIMEOFDAY	3
+#define HAVE_SETTIMEOFDAY   3
 #endif /* !defined HAVE_SETTIMEOFDAY */
 
 #ifndef HAVE_STRERROR
-#define HAVE_STRERROR		1
+#define HAVE_STRERROR       1
 #endif /* !defined HAVE_STRERROR */
 
 #ifndef HAVE_SYMLINK
-#define HAVE_SYMLINK		1
+#define HAVE_SYMLINK        1
 #endif /* !defined HAVE_SYMLINK */
 
 #ifndef HAVE_SYS_STAT_H
-#define HAVE_SYS_STAT_H		1
+#define HAVE_SYS_STAT_H     1
 #endif /* !defined HAVE_SYS_STAT_H */
 
 #ifndef HAVE_SYS_WAIT_H
-#define HAVE_SYS_WAIT_H		1
+#define HAVE_SYS_WAIT_H     1
 #endif /* !defined HAVE_SYS_WAIT_H */
 
 #ifndef HAVE_UNISTD_H
-#define HAVE_UNISTD_H		1
+#define HAVE_UNISTD_H       1
 #endif /* !defined HAVE_UNISTD_H */
 
 #ifndef HAVE_UTMPX_H
-#define HAVE_UTMPX_H		0
+#define HAVE_UTMPX_H        0
 #endif /* !defined HAVE_UTMPX_H */
 
-#ifndef LOCALE_HOME
-#define LOCALE_HOME		"/usr/lib/locale"
-#endif /* !defined LOCALE_HOME */
-
 #if HAVE_INCOMPATIBLE_CTIME_R
 #define asctime_r _incompatible_asctime_r
 #define ctime_r _incompatible_ctime_r
@@ -85,11 +81,11 @@
 ** Nested includes
 */
 
-#include "sys/types.h"	/* for time_t */
+#include "sys/types.h"  /* for time_t */
 #include "stdio.h"
 #include "errno.h"
 #include "string.h"
-#include "limits.h"	/* for CHAR_BIT et al. */
+#include "limits.h" /* for CHAR_BIT et al. */
 #include "time.h"
 #include "stdlib.h"
 
@@ -98,26 +94,26 @@
 #endif /* HAVE_GETTEXT */
 
 #if HAVE_SYS_WAIT_H
-#include <sys/wait.h>	/* for WIFEXITED and WEXITSTATUS */
+#include <sys/wait.h>   /* for WIFEXITED and WEXITSTATUS */
 #endif /* HAVE_SYS_WAIT_H */
 
 #ifndef WIFEXITED
-#define WIFEXITED(status)	(((status) & 0xff) == 0)
+#define WIFEXITED(status)   (((status) & 0xff) == 0)
 #endif /* !defined WIFEXITED */
 #ifndef WEXITSTATUS
-#define WEXITSTATUS(status)	(((status) >> 8) & 0xff)
+#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
 #endif /* !defined WEXITSTATUS */
 
 #if HAVE_UNISTD_H
-#include "unistd.h"	/* for F_OK and R_OK */
+#include "unistd.h" /* for F_OK and R_OK */
 #endif /* HAVE_UNISTD_H */
 
 #if !HAVE_UNISTD_H
 #ifndef F_OK
-#define F_OK	0
+#define F_OK    0
 #endif /* !defined F_OK */
 #ifndef R_OK
-#define R_OK	4
+#define R_OK    4
 #endif /* !defined R_OK */
 #endif /* !HAVE_UNISTD_H */
 
@@ -132,8 +128,8 @@
 */
 #ifndef HAVE_STDINT_H
 #define HAVE_STDINT_H \
-	(199901 <= __STDC_VERSION__ || \
-	2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
+    (199901 <= __STDC_VERSION__ || \
+    2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
 #endif /* !defined HAVE_STDINT_H */
 
 #if HAVE_STDINT_H
@@ -143,13 +139,13 @@
 #ifndef INT_FAST64_MAX
 /* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX.  */
 #if defined LLONG_MAX || defined __LONG_LONG_MAX__
-typedef long long	int_fast64_t;
+typedef long long   int_fast64_t;
 #else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
 #if (LONG_MAX >> 31) < 0xffffffff
 Please use a compiler that supports a 64-bit integer type (or wider);
 you may need to compile with "-DHAVE_STDINT_H".
 #endif /* (LONG_MAX >> 31) < 0xffffffff */
-typedef long		int_fast64_t;
+typedef long        int_fast64_t;
 #endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
 #endif /* !defined INT_FAST64_MAX */
 
@@ -169,7 +165,7 @@
 */
 
 #ifndef P
-#define P(x)	x
+#define P(x)    x
 #endif /* !defined P */
 
 /*
@@ -177,7 +173,7 @@
 */
 
 #ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS	0
+#define EXIT_SUCCESS    0
 #endif /* !defined EXIT_SUCCESS */
 
 /*
@@ -185,7 +181,7 @@
 */
 
 #ifndef EXIT_FAILURE
-#define EXIT_FAILURE	1
+#define EXIT_FAILURE    1
 #endif /* !defined EXIT_FAILURE */
 
 /*
@@ -201,10 +197,10 @@
 #endif /* !defined MAXPATHLEN */
 
 #ifdef MAXPATHLEN
-#define FILENAME_MAX	MAXPATHLEN
+#define FILENAME_MAX    MAXPATHLEN
 #endif /* defined MAXPATHLEN */
 #ifndef MAXPATHLEN
-#define FILENAME_MAX	1024		/* Pure guesswork */
+#define FILENAME_MAX    1024        /* Pure guesswork */
 #endif /* !defined MAXPATHLEN */
 
 #endif /* !defined FILENAME_MAX */
@@ -214,8 +210,8 @@
 */
 
 #ifndef remove
-extern int	unlink P((const char * filename));
-#define remove	unlink
+extern int  unlink P((const char * filename));
+#define remove  unlink
 #endif /* !defined remove */
 
 /*
@@ -235,36 +231,36 @@
 */
 
 #ifndef asctime_r
-extern char *	asctime_r();
+extern char *   asctime_r();
 #endif
 
 /*
 ** Private function declarations.
 */
 
-char *		icalloc P((int nelem, int elsize));
-char *		icatalloc P((char * old, const char * new));
-char *		icpyalloc P((const char * string));
-char *		imalloc P((int n));
-void *		irealloc P((void * pointer, int size));
-void		icfree P((char * pointer));
-void		ifree P((char * pointer));
-const char *	scheck P((const char * string, const char * format));
+char *      icalloc P((int nelem, int elsize));
+char *      icatalloc P((char * old, const char * new));
+char *      icpyalloc P((const char * string));
+char *      imalloc P((int n));
+void *      irealloc P((void * pointer, int size));
+void        icfree P((char * pointer));
+void        ifree P((char * pointer));
+const char *    scheck P((const char * string, const char * format));
 
 /*
 ** Finally, some convenience items.
 */
 
 #ifndef TRUE
-#define TRUE	1
+#define TRUE    1
 #endif /* !defined TRUE */
 
 #ifndef FALSE
-#define FALSE	0
+#define FALSE   0
 #endif /* !defined FALSE */
 
 #ifndef TYPE_BIT
-#define TYPE_BIT(type)	(sizeof (type) * CHAR_BIT)
+#define TYPE_BIT(type)  (sizeof (type) * CHAR_BIT)
 #endif /* !defined TYPE_BIT */
 
 #ifndef TYPE_SIGNED
@@ -288,8 +284,8 @@
 ** add one more for a minus sign if the type is signed.
 */
 #define INT_STRLEN_MAXIMUM(type) \
-	((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
-	1 + TYPE_SIGNED(type))
+    ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
+    1 + TYPE_SIGNED(type))
 #endif /* !defined INT_STRLEN_MAXIMUM */
 
 /*
@@ -309,7 +305,7 @@
 
 #ifndef INITIALIZE
 #ifdef GNUC_or_lint
-#define INITIALIZE(x)	((x) = 0)
+#define INITIALIZE(x)   ((x) = 0)
 #endif /* defined GNUC_or_lint */
 #ifndef GNUC_or_lint
 #define INITIALIZE(x)
@@ -342,7 +338,7 @@
 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
 
 #ifndef YEARSPERREPEAT
-#define YEARSPERREPEAT		400	/* years before a Gregorian repeat */
+#define YEARSPERREPEAT      400 /* years before a Gregorian repeat */
 #endif /* !defined YEARSPERREPEAT */
 
 /*
@@ -350,15 +346,15 @@
 */
 
 #ifndef AVGSECSPERYEAR
-#define AVGSECSPERYEAR		31556952L
+#define AVGSECSPERYEAR      31556952L
 #endif /* !defined AVGSECSPERYEAR */
 
 #ifndef SECSPERREPEAT
-#define SECSPERREPEAT		((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
+#define SECSPERREPEAT       ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
 #endif /* !defined SECSPERREPEAT */
  
 #ifndef SECSPERREPEAT_BITS
-#define SECSPERREPEAT_BITS	34	/* ceil(log2(SECSPERREPEAT)) */
+#define SECSPERREPEAT_BITS  34  /* ceil(log2(SECSPERREPEAT)) */
 #endif /* !defined SECSPERREPEAT_BITS */
 
 /*
diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c
index 946c91c..930ecf4 100644
--- a/libc/tzcode/strftime.c
+++ b/libc/tzcode/strftime.c
@@ -1,6 +1,6 @@
 #ifndef lint
 #ifndef NOID
-static char	elsieid[] = "@(#)strftime.c	8.1";
+static char elsieid[] = "@(#)strftime.c 8.1";
 /*
 ** Based on the UCB version with the ID appearing below.
 ** This is ANSIish only when "multibyte character == plain character".
@@ -29,7 +29,7 @@
 
 #ifndef LIBC_SCCS
 #ifndef lint
-static const char	sccsid[] = "@(#)strftime.c	5.4 (Berkeley) 3/14/89";
+static const char   sccsid[] = "@(#)strftime.c  5.4 (Berkeley) 3/14/89";
 #endif /* !defined lint */
 #endif /* !defined LIBC_SCCS */
 
@@ -37,132 +37,143 @@
 #include "fcntl.h"
 #include "locale.h"
 #include <ctype.h>
+#include <time64.h>
 
+/* struct lc_time_T is now defined as strftime_locale
+ * in <time.h>
+ */
+#if 1
+#define  lc_time_T    strftime_locale
+#else
 struct lc_time_T {
-	const char *	mon[MONSPERYEAR];
-	const char *	month[MONSPERYEAR];
-	const char *	wday[DAYSPERWEEK];
-	const char *	weekday[DAYSPERWEEK];
-	const char *	X_fmt;
-	const char *	x_fmt;
-	const char *	c_fmt;
-	const char *	am;
-	const char *	pm;
-	const char *	date_fmt;
+    const char *    mon[MONSPERYEAR];
+    const char *    month[MONSPERYEAR];
+    const char *    wday[DAYSPERWEEK];
+    const char *    weekday[DAYSPERWEEK];
+    const char *    X_fmt;
+    const char *    x_fmt;
+    const char *    c_fmt;
+    const char *    am;
+    const char *    pm;
+    const char *    date_fmt;
+};
+#endif
+
+#define Locale  (&C_time_locale)
+
+static const struct lc_time_T   C_time_locale = {
+    {
+        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+    }, {
+        "January", "February", "March", "April", "May", "June",
+        "July", "August", "September", "October", "November", "December"
+    }, {
+        "January", "February", "March", "April", "May", "June",
+        "July", "August", "September", "October", "November", "December"
+    }, {
+        "Sun", "Mon", "Tue", "Wed",
+        "Thu", "Fri", "Sat"
+    }, {
+        "Sunday", "Monday", "Tuesday", "Wednesday",
+        "Thursday", "Friday", "Saturday"
+    },
+
+    /* X_fmt */
+    "%H:%M:%S",
+
+    /*
+    ** x_fmt
+    ** C99 requires this format.
+    ** Using just numbers (as here) makes Quakers happier;
+    ** it's also compatible with SVR4.
+    */
+    "%m/%d/%y",
+
+    /*
+    ** c_fmt
+    ** C99 requires this format.
+    ** Previously this code used "%D %X", but we now conform to C99.
+    ** Note that
+    **  "%a %b %d %H:%M:%S %Y"
+    ** is used by Solaris 2.3.
+    */
+    "%a %b %e %T %Y",
+
+    /* am */
+    "AM",
+
+    /* pm */
+    "PM",
+
+    /* date_fmt */
+    "%a %b %e %H:%M:%S %Z %Y"
 };
 
-#ifdef LOCALE_HOME
-#include "sys/stat.h"
-static struct lc_time_T		localebuf;
-static struct lc_time_T *	_loc P((void));
-#define Locale	_loc()
-#endif /* defined LOCALE_HOME */
-#ifndef LOCALE_HOME
-#define Locale	(&C_time_locale)
-#endif /* !defined LOCALE_HOME */
+static char *   _add P((const char *, char *, const char *, int));
+static char *   _conv P((int, const char *, char *, const char *));
+static char *   _fmt P((const char *, const struct tm *, char *, const char *,
+            int *, const struct strftime_locale*));
+static char *   _yconv P((int, int, int, int, char *, const char *, int));
+static char *   getformat P((int, char *, char *, char *, char *));
 
-static const struct lc_time_T	C_time_locale = {
-	{
-		"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-	}, {
-		"January", "February", "March", "April", "May", "June",
-		"July", "August", "September", "October", "November", "December"
-	}, {
-		"Sun", "Mon", "Tue", "Wed",
-		"Thu", "Fri", "Sat"
-	}, {
-		"Sunday", "Monday", "Tuesday", "Wednesday",
-		"Thursday", "Friday", "Saturday"
-	},
-
-	/* X_fmt */
-	"%H:%M:%S",
-
-	/*
-	** x_fmt
-	** C99 requires this format.
-	** Using just numbers (as here) makes Quakers happier;
-	** it's also compatible with SVR4.
-	*/
-	"%m/%d/%y",
-
-	/*
-	** c_fmt
-	** C99 requires this format.
-	** Previously this code used "%D %X", but we now conform to C99.
-	** Note that
-	**	"%a %b %d %H:%M:%S %Y"
-	** is used by Solaris 2.3.
-	*/
-	"%a %b %e %T %Y",
-
-	/* am */
-	"AM",
-
-	/* pm */
-	"PM",
-
-	/* date_fmt */
-	"%a %b %e %H:%M:%S %Z %Y"
-};
-
-static char *	_add P((const char *, char *, const char *, int));
-static char *	_conv P((int, const char *, char *, const char *));
-static char *	_fmt P((const char *, const struct tm *, char *, const char *,
-			int *));
-static char *	_yconv P((int, int, int, int, char *, const char *, int));
-static char *	getformat P((int, char *, char *, char *, char *));
-
-extern char *	tzname[];
+extern char *   tzname[];
 
 #ifndef YEAR_2000_NAME
-#define YEAR_2000_NAME	"CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
+#define YEAR_2000_NAME  "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
 #endif /* !defined YEAR_2000_NAME */
 
-#define IN_NONE	0
-#define IN_SOME	1
-#define IN_THIS	2
-#define IN_ALL	3
+#define IN_NONE 0
+#define IN_SOME 1
+#define IN_THIS 2
+#define IN_ALL  3
 
 #define FORCE_LOWER_CASE 0x100
 
 size_t
 strftime(s, maxsize, format, t)
-char * const		s;
-const size_t		maxsize;
-const char * const	format;
-const struct tm * const	t;
+char * const        s;
+const size_t        maxsize;
+const char * const  format;
+const struct tm * const t;
 {
-	char *	p;
-	int	warn;
+    return strftime_tz(s, maxsize, format, t, Locale);
+}
 
-	tzset();
-#ifdef LOCALE_HOME
-	localebuf.mon[0] = 0;
-#endif /* defined LOCALE_HOME */
-	warn = IN_NONE;
-	p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
-#ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
-	if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
-		(void) fprintf(stderr, "\n");
-		if (format == NULL)
-			(void) fprintf(stderr, "NULL strftime format ");
-		else	(void) fprintf(stderr, "strftime format \"%s\" ",
-				format);
-		(void) fprintf(stderr, "yields only two digits of years in ");
-		if (warn == IN_SOME)
-			(void) fprintf(stderr, "some locales");
-		else if (warn == IN_THIS)
-			(void) fprintf(stderr, "the current locale");
-		else	(void) fprintf(stderr, "all locales");
-		(void) fprintf(stderr, "\n");
-	}
+size_t
+strftime_tz(s, maxsize, format, t, locale)
+char * const        s;
+const size_t        maxsize;
+const char * const  format;
+const struct tm * const t;
+const struct strftime_locale *locale;
+{
+    char *  p;
+    int warn;
+
+    tzset();
+    warn = IN_NONE;
+    p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, locale);
+#if 0  /* ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
+    if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
+        (void) fprintf(stderr, "\n");
+        if (format == NULL)
+            (void) fprintf(stderr, "NULL strftime format ");
+        else    (void) fprintf(stderr, "strftime format \"%s\" ",
+                format);
+        (void) fprintf(stderr, "yields only two digits of years in ");
+        if (warn == IN_SOME)
+            (void) fprintf(stderr, "some locales");
+        else if (warn == IN_THIS)
+            (void) fprintf(stderr, "the current locale");
+        else    (void) fprintf(stderr, "all locales");
+        (void) fprintf(stderr, "\n");
+    }
 #endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
-	if (p == s + maxsize)
-		return 0;
-	*p = '\0';
-	return p - s;
+    if (p == s + maxsize)
+        return 0;
+    *p = '\0';
+    return p - s;
 }
 
 static char *getformat(int modifier, char *normal, char *underscore,
@@ -182,89 +193,97 @@
 }
 
 static char *
-_fmt(format, t, pt, ptlim, warnp)
-const char *		format;
-const struct tm * const	t;
-char *			pt;
-const char * const	ptlim;
-int *			warnp;
+_fmt(format, t, pt, ptlim, warnp, locale)
+const char *        format;
+const struct tm * const t;
+char *          pt;
+const char * const  ptlim;
+int *           warnp;
+const struct strftime_locale* locale;
 {
-	for ( ; *format; ++format) {
-		if (*format == '%') {
+    for ( ; *format; ++format) {
+        if (*format == '%') {
             int modifier = 0;
 label:
-			switch (*++format) {
-			case '\0':
-				--format;
-				break;
-			case 'A':
-				pt = _add((t->tm_wday < 0 ||
-					t->tm_wday >= DAYSPERWEEK) ?
-					"?" : Locale->weekday[t->tm_wday],
-					pt, ptlim, modifier);
-				continue;
-			case 'a':
-				pt = _add((t->tm_wday < 0 ||
-					t->tm_wday >= DAYSPERWEEK) ?
-					"?" : Locale->wday[t->tm_wday],
-					pt, ptlim, modifier);
-				continue;
-			case 'B':
-				pt = _add((t->tm_mon < 0 ||
-					t->tm_mon >= MONSPERYEAR) ?
-					"?" : Locale->month[t->tm_mon],
-					pt, ptlim, modifier);
-				continue;
-			case 'b':
-			case 'h':
-				pt = _add((t->tm_mon < 0 ||
-					t->tm_mon >= MONSPERYEAR) ?
-					"?" : Locale->mon[t->tm_mon],
-					pt, ptlim, modifier);
-				continue;
-			case 'C':
-				/*
-				** %C used to do a...
-				**	_fmt("%a %b %e %X %Y", t);
-				** ...whereas now POSIX 1003.2 calls for
-				** something completely different.
-				** (ado, 1993-05-24)
-				*/
-				pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
-					pt, ptlim, modifier);
-				continue;
-			case 'c':
-				{
-				int warn2 = IN_SOME;
+            switch (*++format) {
+            case '\0':
+                --format;
+                break;
+            case 'A':
+                pt = _add((t->tm_wday < 0 ||
+                    t->tm_wday >= DAYSPERWEEK) ?
+                    "?" : locale->weekday[t->tm_wday],
+                    pt, ptlim, modifier);
+                continue;
+            case 'a':
+                pt = _add((t->tm_wday < 0 ||
+                    t->tm_wday >= DAYSPERWEEK) ?
+                    "?" : locale->wday[t->tm_wday],
+                    pt, ptlim, modifier);
+                continue;
+            case 'B':
+                if (modifier == '-') {
+                    pt = _add((t->tm_mon < 0 ||
+                                t->tm_mon >= MONSPERYEAR) ?
+                                "?" : Locale->standalone_month[t->tm_mon],
+                                pt, ptlim, modifier);
+                } else {
+                    pt = _add((t->tm_mon < 0 ||
+                                t->tm_mon >= MONSPERYEAR) ?
+                                "?" : Locale->month[t->tm_mon],
+                                pt, ptlim, modifier);
+                }
+                continue;
+            case 'b':
+            case 'h':
+                pt = _add((t->tm_mon < 0 ||
+                    t->tm_mon >= MONSPERYEAR) ?
+                    "?" : locale->mon[t->tm_mon],
+                    pt, ptlim, modifier);
+                continue;
+            case 'C':
+                /*
+                ** %C used to do a...
+                **  _fmt("%a %b %e %X %Y", t);
+                ** ...whereas now POSIX 1003.2 calls for
+                ** something completely different.
+                ** (ado, 1993-05-24)
+                */
+                pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
+                    pt, ptlim, modifier);
+                continue;
+            case 'c':
+                {
+                int warn2 = IN_SOME;
 
-				pt = _fmt(Locale->c_fmt, t, pt, ptlim, warnp);
-				if (warn2 == IN_ALL)
-					warn2 = IN_THIS;
-				if (warn2 > *warnp)
-					*warnp = warn2;
-				}
-				continue;
-			case 'D':
-                                pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp);
-				continue;
-			case 'd':
+                pt = _fmt(locale->c_fmt, t, pt, ptlim, warnp, locale);
+                if (warn2 == IN_ALL)
+                    warn2 = IN_THIS;
+                if (warn2 > *warnp)
+                    *warnp = warn2;
+                }
+                continue;
+            case 'D':
+                                pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, locale);
+                continue;
+            case 'd':
                                 pt = _conv(t->tm_mday,
                                            getformat(modifier, "%02d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
-			case 'E':
-			case 'O':
-				/*
-				** C99 locale modifiers.
-				** The sequences
-				**	%Ec %EC %Ex %EX %Ey %EY
-				**	%Od %oe %OH %OI %Om %OM
-				**	%OS %Ou %OU %OV %Ow %OW %Oy
-				** are supposed to provide alternate
-				** representations.
-				*/
-				goto label;
+                continue;
+            case 'E':
+            case 'O':
+                /*
+                ** C99 locale modifiers.
+                ** The sequences
+                **  %Ec %EC %Ex %EX %Ey %EY
+                **  %Od %oe %OH %OI %Om %OM
+                **  %OS %Ou %OU %OV %Ow %OW %Oy
+                ** are supposed to provide alternate
+                ** representations.
+                */
+                goto label;
             case '_':
             case '-':
             case '0':
@@ -272,155 +291,155 @@
             case '#':
                 modifier = *format;
                 goto label;
-			case 'e':
-				pt = _conv(t->tm_mday,
+            case 'e':
+                pt = _conv(t->tm_mday,
                                            getformat(modifier, "%2d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
-			case 'F':
-				pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
-				continue;
-			case 'H':
-				pt = _conv(t->tm_hour,
+                continue;
+            case 'F':
+                pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, locale);
+                continue;
+            case 'H':
+                pt = _conv(t->tm_hour,
                                            getformat(modifier, "%02d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
-			case 'I':
-				pt = _conv((t->tm_hour % 12) ?
-					(t->tm_hour % 12) : 12,
-					getformat(modifier, "%02d",
+                continue;
+            case 'I':
+                pt = _conv((t->tm_hour % 12) ?
+                    (t->tm_hour % 12) : 12,
+                    getformat(modifier, "%02d",
                                                   "%2d", "%d", "%02d"),
                                         pt, ptlim);
-				continue;
-			case 'j':
-				pt = _conv(t->tm_yday + 1,
+                continue;
+            case 'j':
+                pt = _conv(t->tm_yday + 1,
                            getformat(modifier, "%03d", "%3d", "%d", "%03d"),
                            pt, ptlim);
-				continue;
-			case 'k':
-				/*
-				** This used to be...
-				**	_conv(t->tm_hour % 12 ?
-				**		t->tm_hour % 12 : 12, 2, ' ');
-				** ...and has been changed to the below to
-				** match SunOS 4.1.1 and Arnold Robbins'
-				** strftime version 3.0. That is, "%k" and
-				** "%l" have been swapped.
-				** (ado, 1993-05-24)
-				*/
-				pt = _conv(t->tm_hour,
+                continue;
+            case 'k':
+                /*
+                ** This used to be...
+                **  _conv(t->tm_hour % 12 ?
+                **      t->tm_hour % 12 : 12, 2, ' ');
+                ** ...and has been changed to the below to
+                ** match SunOS 4.1.1 and Arnold Robbins'
+                ** strftime version 3.0. That is, "%k" and
+                ** "%l" have been swapped.
+                ** (ado, 1993-05-24)
+                */
+                pt = _conv(t->tm_hour,
                                            getformat(modifier, "%2d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
+                continue;
 #ifdef KITCHEN_SINK
-			case 'K':
-				/*
-				** After all this time, still unclaimed!
-				*/
-				pt = _add("kitchen sink", pt, ptlim, modifier);
-				continue;
+            case 'K':
+                /*
+                ** After all this time, still unclaimed!
+                */
+                pt = _add("kitchen sink", pt, ptlim, modifier);
+                continue;
 #endif /* defined KITCHEN_SINK */
-			case 'l':
-				/*
-				** This used to be...
-				**	_conv(t->tm_hour, 2, ' ');
-				** ...and has been changed to the below to
-				** match SunOS 4.1.1 and Arnold Robbin's
-				** strftime version 3.0. That is, "%k" and
-				** "%l" have been swapped.
-				** (ado, 1993-05-24)
-				*/
-				pt = _conv((t->tm_hour % 12) ?
-					(t->tm_hour % 12) : 12,
-					getformat(modifier, "%2d",
+            case 'l':
+                /*
+                ** This used to be...
+                **  _conv(t->tm_hour, 2, ' ');
+                ** ...and has been changed to the below to
+                ** match SunOS 4.1.1 and Arnold Robbin's
+                ** strftime version 3.0. That is, "%k" and
+                ** "%l" have been swapped.
+                ** (ado, 1993-05-24)
+                */
+                pt = _conv((t->tm_hour % 12) ?
+                    (t->tm_hour % 12) : 12,
+                    getformat(modifier, "%2d",
                                                   "%2d", "%d", "%02d"),
                                         pt, ptlim);
-				continue;
-			case 'M':
-				pt = _conv(t->tm_min,
+                continue;
+            case 'M':
+                pt = _conv(t->tm_min,
                                            getformat(modifier, "%02d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
-			case 'm':
-				pt = _conv(t->tm_mon + 1,
+                continue;
+            case 'm':
+                pt = _conv(t->tm_mon + 1,
                                            getformat(modifier, "%02d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
-			case 'n':
-				pt = _add("\n", pt, ptlim, modifier);
-				continue;
-			case 'p':
-				pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
-					Locale->pm :
-					Locale->am,
-					pt, ptlim, modifier);
-				continue;
-			case 'P':
-				pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
-					Locale->pm :
-					Locale->am,
-					pt, ptlim, FORCE_LOWER_CASE);
-				continue;
-			case 'R':
-				pt = _fmt("%H:%M", t, pt, ptlim, warnp);
-				continue;
-			case 'r':
-				pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp);
-				continue;
-			case 'S':
-				pt = _conv(t->tm_sec,
+                continue;
+            case 'n':
+                pt = _add("\n", pt, ptlim, modifier);
+                continue;
+            case 'p':
+                pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
+                    locale->pm :
+                    locale->am,
+                    pt, ptlim, modifier);
+                continue;
+            case 'P':
+                pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
+                    locale->pm :
+                    locale->am,
+                    pt, ptlim, FORCE_LOWER_CASE);
+                continue;
+            case 'R':
+                pt = _fmt("%H:%M", t, pt, ptlim, warnp, locale);
+                continue;
+            case 'r':
+                pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp, locale);
+                continue;
+            case 'S':
+                pt = _conv(t->tm_sec,
                                            getformat(modifier, "%02d",
                                                      "%2d", "%d", "%02d"),
                                            pt, ptlim);
-				continue;
-			case 's':
-				{
-					struct tm	tm;
-					char		buf[INT_STRLEN_MAXIMUM(
-								time_t) + 1];
-					time_t		mkt;
+                continue;
+            case 's':
+                {
+                    struct tm   tm;
+                    char        buf[INT_STRLEN_MAXIMUM(
+                                time64_t) + 1];
+                    time64_t    mkt;
 
-					tm = *t;
-					mkt = mktime(&tm);
-					if (TYPE_SIGNED(time_t))
-						(void) sprintf(buf, "%ld",
-							(long) mkt);
-					else	(void) sprintf(buf, "%lu",
-							(unsigned long) mkt);
-					pt = _add(buf, pt, ptlim, modifier);
-				}
-				continue;
-			case 'T':
-				pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp);
-				continue;
-			case 't':
-				pt = _add("\t", pt, ptlim, modifier);
-				continue;
-			case 'U':
-				pt = _conv((t->tm_yday + DAYSPERWEEK -
-					t->tm_wday) / DAYSPERWEEK,
-					getformat(modifier, "%02d",
+                    tm = *t;
+                    mkt = mktime64(&tm);
+                    if (TYPE_SIGNED(time64_t))
+                        (void) sprintf(buf, "%lld",
+                            (long long) mkt);
+                    else    (void) sprintf(buf, "%llu",
+                            (unsigned long long) mkt);
+                    pt = _add(buf, pt, ptlim, modifier);
+                }
+                continue;
+            case 'T':
+                pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp, locale);
+                continue;
+            case 't':
+                pt = _add("\t", pt, ptlim, modifier);
+                continue;
+            case 'U':
+                pt = _conv((t->tm_yday + DAYSPERWEEK -
+                    t->tm_wday) / DAYSPERWEEK,
+                    getformat(modifier, "%02d",
                                                   "%2d", "%d", "%02d"),
                                         pt, ptlim);
-				continue;
-			case 'u':
-				/*
-				** From Arnold Robbins' strftime version 3.0:
-				** "ISO 8601: Weekday as a decimal number
-				** [1 (Monday) - 7]"
-				** (ado, 1993-05-24)
-				*/
-				pt = _conv((t->tm_wday == 0) ?
-					DAYSPERWEEK : t->tm_wday, "%d", pt, ptlim);
-				continue;
-			case 'V':	/* ISO 8601 week number */
-			case 'G':	/* ISO 8601 year (four digits) */
-			case 'g':	/* ISO 8601 year (two digits) */
+                continue;
+            case 'u':
+                /*
+                ** From Arnold Robbins' strftime version 3.0:
+                ** "ISO 8601: Weekday as a decimal number
+                ** [1 (Monday) - 7]"
+                ** (ado, 1993-05-24)
+                */
+                pt = _conv((t->tm_wday == 0) ?
+                    DAYSPERWEEK : t->tm_wday, "%d", pt, ptlim);
+                continue;
+            case 'V':   /* ISO 8601 week number */
+            case 'G':   /* ISO 8601 year (four digits) */
+            case 'g':   /* ISO 8601 year (two digits) */
 /*
 ** From Arnold Robbins' strftime version 3.0: "the week number of the
 ** year (the first Monday as the first day of week 1) as a decimal number
@@ -439,232 +458,232 @@
 ** 1997 lasts from 1996-12-30 to 1997-01-05..."
 ** (ado, 1996-01-02)
 */
-				{
-					int	year;
-					int	base;
-					int	yday;
-					int	wday;
-					int	w;
+                {
+                    int year;
+                    int base;
+                    int yday;
+                    int wday;
+                    int w;
 
-					year = t->tm_year;
-					base = TM_YEAR_BASE;
-					yday = t->tm_yday;
-					wday = t->tm_wday;
-					for ( ; ; ) {
-						int	len;
-						int	bot;
-						int	top;
+                    year = t->tm_year;
+                    base = TM_YEAR_BASE;
+                    yday = t->tm_yday;
+                    wday = t->tm_wday;
+                    for ( ; ; ) {
+                        int len;
+                        int bot;
+                        int top;
 
-						len = isleap_sum(year, base) ?
-							DAYSPERLYEAR :
-							DAYSPERNYEAR;
-						/*
-						** What yday (-3 ... 3) does
-						** the ISO year begin on?
-						*/
-						bot = ((yday + 11 - wday) %
-							DAYSPERWEEK) - 3;
-						/*
-						** What yday does the NEXT
-						** ISO year begin on?
-						*/
-						top = bot -
-							(len % DAYSPERWEEK);
-						if (top < -3)
-							top += DAYSPERWEEK;
-						top += len;
-						if (yday >= top) {
-							++base;
-							w = 1;
-							break;
-						}
-						if (yday >= bot) {
-							w = 1 + ((yday - bot) /
-								DAYSPERWEEK);
-							break;
-						}
-						--base;
-						yday += isleap_sum(year, base) ?
-							DAYSPERLYEAR :
-							DAYSPERNYEAR;
-					}
+                        len = isleap_sum(year, base) ?
+                            DAYSPERLYEAR :
+                            DAYSPERNYEAR;
+                        /*
+                        ** What yday (-3 ... 3) does
+                        ** the ISO year begin on?
+                        */
+                        bot = ((yday + 11 - wday) %
+                            DAYSPERWEEK) - 3;
+                        /*
+                        ** What yday does the NEXT
+                        ** ISO year begin on?
+                        */
+                        top = bot -
+                            (len % DAYSPERWEEK);
+                        if (top < -3)
+                            top += DAYSPERWEEK;
+                        top += len;
+                        if (yday >= top) {
+                            ++base;
+                            w = 1;
+                            break;
+                        }
+                        if (yday >= bot) {
+                            w = 1 + ((yday - bot) /
+                                DAYSPERWEEK);
+                            break;
+                        }
+                        --base;
+                        yday += isleap_sum(year, base) ?
+                            DAYSPERLYEAR :
+                            DAYSPERNYEAR;
+                    }
 #ifdef XPG4_1994_04_09
-					if ((w == 52 &&
-						t->tm_mon == TM_JANUARY) ||
-						(w == 1 &&
-						t->tm_mon == TM_DECEMBER))
-							w = 53;
+                    if ((w == 52 &&
+                        t->tm_mon == TM_JANUARY) ||
+                        (w == 1 &&
+                        t->tm_mon == TM_DECEMBER))
+                            w = 53;
 #endif /* defined XPG4_1994_04_09 */
-					if (*format == 'V')
-						pt = _conv(w,
+                    if (*format == 'V')
+                        pt = _conv(w,
                                                            getformat(modifier,
                                                                      "%02d",
                                                                      "%2d",
                                                                      "%d",
                                                                      "%02d"),
-							   pt, ptlim);
-					else if (*format == 'g') {
-						*warnp = IN_ALL;
-						pt = _yconv(year, base, 0, 1,
-							pt, ptlim, modifier);
-					} else	pt = _yconv(year, base, 1, 1,
-							pt, ptlim, modifier);
-				}
-				continue;
-			case 'v':
-				/*
-				** From Arnold Robbins' strftime version 3.0:
-				** "date as dd-bbb-YYYY"
-				** (ado, 1993-05-24)
-				*/
-				pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
-				continue;
-			case 'W':
-				pt = _conv((t->tm_yday + DAYSPERWEEK -
-					(t->tm_wday ?
-					(t->tm_wday - 1) :
-					(DAYSPERWEEK - 1))) / DAYSPERWEEK,
-					getformat(modifier, "%02d",
+                               pt, ptlim);
+                    else if (*format == 'g') {
+                        *warnp = IN_ALL;
+                        pt = _yconv(year, base, 0, 1,
+                            pt, ptlim, modifier);
+                    } else  pt = _yconv(year, base, 1, 1,
+                            pt, ptlim, modifier);
+                }
+                continue;
+            case 'v':
+                /*
+                ** From Arnold Robbins' strftime version 3.0:
+                ** "date as dd-bbb-YYYY"
+                ** (ado, 1993-05-24)
+                */
+                pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, locale);
+                continue;
+            case 'W':
+                pt = _conv((t->tm_yday + DAYSPERWEEK -
+                    (t->tm_wday ?
+                    (t->tm_wday - 1) :
+                    (DAYSPERWEEK - 1))) / DAYSPERWEEK,
+                    getformat(modifier, "%02d",
                                                   "%2d", "%d", "%02d"),
                                         pt, ptlim);
-				continue;
-			case 'w':
-				pt = _conv(t->tm_wday, "%d", pt, ptlim);
-				continue;
-			case 'X':
-				pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp);
-				continue;
-			case 'x':
-				{
-				int	warn2 = IN_SOME;
+                continue;
+            case 'w':
+                pt = _conv(t->tm_wday, "%d", pt, ptlim);
+                continue;
+            case 'X':
+                pt = _fmt(locale->X_fmt, t, pt, ptlim, warnp, locale);
+                continue;
+            case 'x':
+                {
+                int warn2 = IN_SOME;
 
-				pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2);
-				if (warn2 == IN_ALL)
-					warn2 = IN_THIS;
-				if (warn2 > *warnp)
-					*warnp = warn2;
-				}
-				continue;
-			case 'y':
-				*warnp = IN_ALL;
-				pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
-					pt, ptlim, modifier);
-				continue;
-			case 'Y':
-				pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
-					pt, ptlim, modifier);
-				continue;
-			case 'Z':
+                pt = _fmt(locale->x_fmt, t, pt, ptlim, &warn2, locale);
+                if (warn2 == IN_ALL)
+                    warn2 = IN_THIS;
+                if (warn2 > *warnp)
+                    *warnp = warn2;
+                }
+                continue;
+            case 'y':
+                *warnp = IN_ALL;
+                pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
+                    pt, ptlim, modifier);
+                continue;
+            case 'Y':
+                pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
+                    pt, ptlim, modifier);
+                continue;
+            case 'Z':
 #ifdef TM_ZONE
-				if (t->TM_ZONE != NULL)
-					pt = _add(t->TM_ZONE, pt, ptlim,
+                if (t->TM_ZONE != NULL)
+                    pt = _add(t->TM_ZONE, pt, ptlim,
                                                   modifier);
-				else
+                else
 #endif /* defined TM_ZONE */
-				if (t->tm_isdst >= 0)
-					pt = _add(tzname[t->tm_isdst != 0],
-						pt, ptlim, modifier);
-				/*
-				** C99 says that %Z must be replaced by the
-				** empty string if the time zone is not
-				** determinable.
-				*/
-				continue;
-			case 'z':
-				{
-				int		diff;
-				char const *	sign;
+                if (t->tm_isdst >= 0)
+                    pt = _add(tzname[t->tm_isdst != 0],
+                        pt, ptlim, modifier);
+                /*
+                ** C99 says that %Z must be replaced by the
+                ** empty string if the time zone is not
+                ** determinable.
+                */
+                continue;
+            case 'z':
+                {
+                int     diff;
+                char const *    sign;
 
-				if (t->tm_isdst < 0)
-					continue;
+                if (t->tm_isdst < 0)
+                    continue;
 #ifdef TM_GMTOFF
-				diff = t->TM_GMTOFF;
+                diff = t->TM_GMTOFF;
 #else /* !defined TM_GMTOFF */
-				/*
-				** C99 says that the UTC offset must
-				** be computed by looking only at
-				** tm_isdst. This requirement is
-				** incorrect, since it means the code
-				** must rely on magic (in this case
-				** altzone and timezone), and the
-				** magic might not have the correct
-				** offset. Doing things correctly is
-				** tricky and requires disobeying C99;
-				** see GNU C strftime for details.
-				** For now, punt and conform to the
-				** standard, even though it's incorrect.
-				**
-				** C99 says that %z must be replaced by the
-				** empty string if the time zone is not
-				** determinable, so output nothing if the
-				** appropriate variables are not available.
-				*/
-				if (t->tm_isdst == 0)
+                /*
+                ** C99 says that the UTC offset must
+                ** be computed by looking only at
+                ** tm_isdst. This requirement is
+                ** incorrect, since it means the code
+                ** must rely on magic (in this case
+                ** altzone and timezone), and the
+                ** magic might not have the correct
+                ** offset. Doing things correctly is
+                ** tricky and requires disobeying C99;
+                ** see GNU C strftime for details.
+                ** For now, punt and conform to the
+                ** standard, even though it's incorrect.
+                **
+                ** C99 says that %z must be replaced by the
+                ** empty string if the time zone is not
+                ** determinable, so output nothing if the
+                ** appropriate variables are not available.
+                */
+                if (t->tm_isdst == 0)
 #ifdef USG_COMPAT
-					diff = -timezone;
+                    diff = -timezone;
 #else /* !defined USG_COMPAT */
-					continue;
+                    continue;
 #endif /* !defined USG_COMPAT */
-				else
+                else
 #ifdef ALTZONE
-					diff = -altzone;
+                    diff = -altzone;
 #else /* !defined ALTZONE */
-					continue;
+                    continue;
 #endif /* !defined ALTZONE */
 #endif /* !defined TM_GMTOFF */
-				if (diff < 0) {
-					sign = "-";
-					diff = -diff;
-				} else	sign = "+";
-				pt = _add(sign, pt, ptlim, modifier);
-				diff /= SECSPERMIN;
-				diff = (diff / MINSPERHOUR) * 100 +
-					(diff % MINSPERHOUR);
-				pt = _conv(diff,
+                if (diff < 0) {
+                    sign = "-";
+                    diff = -diff;
+                } else  sign = "+";
+                pt = _add(sign, pt, ptlim, modifier);
+                diff /= SECSPERMIN;
+                diff = (diff / MINSPERHOUR) * 100 +
+                    (diff % MINSPERHOUR);
+                pt = _conv(diff,
                                            getformat(modifier, "%04d",
                                                      "%4d", "%d", "%04d"),
                                            pt, ptlim);
-				}
-				continue;
-			case '+':
-				pt = _fmt(Locale->date_fmt, t, pt, ptlim,
-					warnp);
-				continue;
-			case '%':
-			/*
-			** X311J/88-090 (4.12.3.5): if conversion char is
-			** undefined, behavior is undefined. Print out the
-			** character itself as printf(3) also does.
-			*/
-			default:
-				break;
-			}
-		}
-		if (pt == ptlim)
-			break;
-		*pt++ = *format;
-	}
-	return pt;
+                }
+                continue;
+            case '+':
+                pt = _fmt(locale->date_fmt, t, pt, ptlim,
+                    warnp, locale);
+                continue;
+            case '%':
+            /*
+            ** X311J/88-090 (4.12.3.5): if conversion char is
+            ** undefined, behavior is undefined. Print out the
+            ** character itself as printf(3) also does.
+            */
+            default:
+                break;
+            }
+        }
+        if (pt == ptlim)
+            break;
+        *pt++ = *format;
+    }
+    return pt;
 }
 
 static char *
 _conv(n, format, pt, ptlim)
-const int		n;
-const char * const	format;
-char * const		pt;
-const char * const	ptlim;
+const int       n;
+const char * const  format;
+char * const        pt;
+const char * const  ptlim;
 {
-	char	buf[INT_STRLEN_MAXIMUM(int) + 1];
+    char    buf[INT_STRLEN_MAXIMUM(int) + 1];
 
-	(void) sprintf(buf, format, n);
-	return _add(buf, pt, ptlim, 0);
+    (void) snprintf(buf, sizeof(buf), format, n);
+    return _add(buf, pt, ptlim, 0);
 }
 
 static char *
 _add(str, pt, ptlim, modifier)
-const char *		str;
-char *			pt;
-const char * const	ptlim;
+const char *        str;
+char *          pt;
+const char * const  ptlim;
 int                     modifier;
 {
         int c;
@@ -701,7 +720,7 @@
                 }
         }
 
-	return pt;
+    return pt;
 }
 
 /*
@@ -714,159 +733,38 @@
 
 static char *
 _yconv(a, b, convert_top, convert_yy, pt, ptlim, modifier)
-const int		a;
-const int		b;
-const int		convert_top;
-const int		convert_yy;
-char *			pt;
-const char * const	ptlim;
+const int       a;
+const int       b;
+const int       convert_top;
+const int       convert_yy;
+char *          pt;
+const char * const  ptlim;
 int                     modifier;
 {
-	register int	lead;
-	register int	trail;
+    register int    lead;
+    register int    trail;
 
-#define DIVISOR	100
-	trail = a % DIVISOR + b % DIVISOR;
-	lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR;
-	trail %= DIVISOR;
-	if (trail < 0 && lead > 0) {
-		trail += DIVISOR;
-		--lead;
-	} else if (lead < 0 && trail > 0) {
-		trail -= DIVISOR;
-		++lead;
-	}
-	if (convert_top) {
-		if (lead == 0 && trail < 0)
-			pt = _add("-0", pt, ptlim, modifier);
-		else	pt = _conv(lead, getformat(modifier, "%02d",
+#define DIVISOR 100
+    trail = a % DIVISOR + b % DIVISOR;
+    lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR;
+    trail %= DIVISOR;
+    if (trail < 0 && lead > 0) {
+        trail += DIVISOR;
+        --lead;
+    } else if (lead < 0 && trail > 0) {
+        trail -= DIVISOR;
+        ++lead;
+    }
+    if (convert_top) {
+        if (lead == 0 && trail < 0)
+            pt = _add("-0", pt, ptlim, modifier);
+        else    pt = _conv(lead, getformat(modifier, "%02d",
                                                    "%2d", "%d", "%02d"),
                                    pt, ptlim);
-	}
-	if (convert_yy)
-		pt = _conv(((trail < 0) ? -trail : trail),
+    }
+    if (convert_yy)
+        pt = _conv(((trail < 0) ? -trail : trail),
                            getformat(modifier, "%02d", "%2d", "%d", "%02d"),
                            pt, ptlim);
-	return pt;
+    return pt;
 }
-
-#ifdef LOCALE_HOME
-static struct lc_time_T *
-_loc P((void))
-{
-	static const char	locale_home[] = LOCALE_HOME;
-	static const char	lc_time[] = "LC_TIME";
-	static char *		locale_buf;
-
-	int			fd;
-	int			oldsun;	/* "...ain't got nothin' to do..." */
-	char *			lbuf;
-	char *			name;
-	char *			p;
-	const char **		ap;
-	const char *		plim;
-	char			filename[FILENAME_MAX];
-	struct stat		st;
-	size_t			namesize;
-	size_t			bufsize;
-
-	/*
-	** Use localebuf.mon[0] to signal whether locale is already set up.
-	*/
-	if (localebuf.mon[0])
-		return &localebuf;
-	name = setlocale(LC_TIME, (char *) NULL);
-	if (name == NULL || *name == '\0')
-		goto no_locale;
-	/*
-	** If the locale name is the same as our cache, use the cache.
-	*/
-	lbuf = locale_buf;
-	if (lbuf != NULL && strcmp(name, lbuf) == 0) {
-		p = lbuf;
-		for (ap = (const char **) &localebuf;
-			ap < (const char **) (&localebuf + 1);
-				++ap)
-					*ap = p += strlen(p) + 1;
-		return &localebuf;
-	}
-	/*
-	** Slurp the locale file into the cache.
-	*/
-	namesize = strlen(name) + 1;
-	if (sizeof filename <
-		((sizeof locale_home) + namesize + (sizeof lc_time)))
-			goto no_locale;
-	oldsun = 0;
-	(void) sprintf(filename, "%s/%s/%s", locale_home, name, lc_time);
-	fd = open(filename, O_RDONLY);
-	if (fd < 0) {
-		/*
-		** Old Sun systems have a different naming and data convention.
-		*/
-		oldsun = 1;
-		(void) sprintf(filename, "%s/%s/%s", locale_home,
-			lc_time, name);
-		fd = open(filename, O_RDONLY);
-		if (fd < 0)
-			goto no_locale;
-	}
-	if (fstat(fd, &st) != 0)
-		goto bad_locale;
-	if (st.st_size <= 0)
-		goto bad_locale;
-	bufsize = namesize + st.st_size;
-	locale_buf = NULL;
-	lbuf = (lbuf == NULL) ? malloc(bufsize) : realloc(lbuf, bufsize);
-	if (lbuf == NULL)
-		goto bad_locale;
-	(void) strcpy(lbuf, name);
-	p = lbuf + namesize;
-	plim = p + st.st_size;
-	if (read(fd, p, (size_t) st.st_size) != st.st_size)
-		goto bad_lbuf;
-	if (close(fd) != 0)
-		goto bad_lbuf;
-	/*
-	** Parse the locale file into localebuf.
-	*/
-	if (plim[-1] != '\n')
-		goto bad_lbuf;
-	for (ap = (const char **) &localebuf;
-		ap < (const char **) (&localebuf + 1);
-			++ap) {
-				if (p == plim)
-					goto bad_lbuf;
-				*ap = p;
-				while (*p != '\n')
-					++p;
-				*p++ = '\0';
-	}
-	if (oldsun) {
-		/*
-		** SunOS 4 used an obsolescent format; see localdtconv(3).
-		** c_fmt had the ``short format for dates and times together''
-		** (SunOS 4 date, "%a %b %e %T %Z %Y" in the C locale);
-		** date_fmt had the ``long format for dates''
-		** (SunOS 4 strftime %C, "%A, %B %e, %Y" in the C locale).
-		** Discard the latter in favor of the former.
-		*/
-		localebuf.date_fmt = localebuf.c_fmt;
-	}
-	/*
-	** Record the successful parse in the cache.
-	*/
-	locale_buf = lbuf;
-
-	return &localebuf;
-
-bad_lbuf:
-	free(lbuf);
-bad_locale:
-	(void) close(fd);
-no_locale:
-	localebuf = C_time_locale;
-	locale_buf = NULL;
-	return &localebuf;
-}
-#endif /* defined LOCALE_HOME */
diff --git a/libc/tzcode/strptime.c b/libc/tzcode/strptime.c
index 982daf4..1f481c9 100644
--- a/libc/tzcode/strptime.c
+++ b/libc/tzcode/strptime.c
@@ -1,5 +1,5 @@
-/*	$OpenBSD: strptime.c,v 1.11 2005/08/08 08:05:38 espie Exp $ */
-/*	$NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $	*/
+/*  $OpenBSD: strptime.c,v 1.11 2005/08/08 08:05:38 espie Exp $ */
+/*  $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -44,387 +44,387 @@
 #include "tzfile.h"
 
 static const struct {
-	const char *abday[7];
-	const char *day[7];
-	const char *abmon[12];
-	const char *mon[12];
-	const char *am_pm[2];
-	const char *d_t_fmt;
-	const char *d_fmt;
-	const char *t_fmt;
-	const char *t_fmt_ampm;
+    const char *abday[7];
+    const char *day[7];
+    const char *abmon[12];
+    const char *mon[12];
+    const char *am_pm[2];
+    const char *d_t_fmt;
+    const char *d_fmt;
+    const char *t_fmt;
+    const char *t_fmt_ampm;
 } _DefaultTimeLocale = {
-	{
-		"Sun","Mon","Tue","Wed","Thu","Fri","Sat",
-	},
-	{
-		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
-		"Friday", "Saturday"
-	},
-	{
-		"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-	},
-	{
-		"January", "February", "March", "April", "May", "June", "July",
-		"August", "September", "October", "November", "December"
-	},
-	{
-		"AM", "PM"
-	},
-	"%a %b %d %H:%M:%S %Y",
-	"%m/%d/%y",
-	"%H:%M:%S",
-	"%I:%M:%S %p"
+    {
+        "Sun","Mon","Tue","Wed","Thu","Fri","Sat",
+    },
+    {
+        "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+        "Friday", "Saturday"
+    },
+    {
+        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+    },
+    {
+        "January", "February", "March", "April", "May", "June", "July",
+        "August", "September", "October", "November", "December"
+    },
+    {
+        "AM", "PM"
+    },
+    "%a %b %d %H:%M:%S %Y",
+    "%m/%d/%y",
+    "%H:%M:%S",
+    "%I:%M:%S %p"
 };
 
-#define	_ctloc(x) (_DefaultTimeLocale.x)
+#define _ctloc(x) (_DefaultTimeLocale.x)
 
 /*
  * We do not implement alternate representations. However, we always
  * check whether a given modifier is allowed for a certain conversion.
  */
-#define _ALT_E			0x01
-#define _ALT_O			0x02
-#define	_LEGAL_ALT(x)		{ if (alt_format & ~(x)) return (0); }
+#define _ALT_E          0x01
+#define _ALT_O          0x02
+#define _LEGAL_ALT(x)       { if (alt_format & ~(x)) return (0); }
 
 
-static	int _conv_num(const unsigned char **, int *, int, int);
-static	char *_strptime(const char *, const char *, struct tm *, int);
+static  int _conv_num(const unsigned char **, int *, int, int);
+static  unsigned char *_strptime(const unsigned char *, const char *, struct tm *, int);
 
 
 char *
 strptime(const char *buf, const char *fmt, struct tm *tm)
 {
-	return(_strptime(buf, fmt, tm, 1));
+    return (char*)(_strptime((const unsigned char*)buf, fmt, tm, 1));
 }
 
-static char *
-_strptime(const char *buf, const char *fmt, struct tm *tm, int initialize)
+static unsigned char *
+_strptime(const unsigned char *buf, const char *fmt, struct tm *tm, int initialize)
 {
-	unsigned char c;
-	const unsigned char *bp;
-	size_t len;
-	int alt_format, i;
-	static int century, relyear;
+    unsigned char c;
+    const unsigned char *bp;
+    size_t len = 0;
+    int alt_format, i;
+    static int century, relyear;
 
-	if (initialize) {
-		century = TM_YEAR_BASE;
-		relyear = -1;
-	}
+    if (initialize) {
+        century = TM_YEAR_BASE;
+        relyear = -1;
+    }
 
-	bp = (unsigned char *)buf;
-	while ((c = *fmt) != '\0') {
-		/* Clear `alternate' modifier prior to new conversion. */
-		alt_format = 0;
+    bp = (unsigned char *)buf;
+    while ((c = *fmt) != '\0') {
+        /* Clear `alternate' modifier prior to new conversion. */
+        alt_format = 0;
 
-		/* Eat up white-space. */
-		if (isspace(c)) {
-			while (isspace(*bp))
-				bp++;
+        /* Eat up white-space. */
+        if (isspace(c)) {
+            while (isspace(*bp))
+                bp++;
 
-			fmt++;
-			continue;
-		}
-				
-		if ((c = *fmt++) != '%')
-			goto literal;
+            fmt++;
+            continue;
+        }
+                
+        if ((c = *fmt++) != '%')
+            goto literal;
 
 
-again:		switch (c = *fmt++) {
-		case '%':	/* "%%" is converted to "%". */
+again:      switch (c = *fmt++) {
+        case '%':   /* "%%" is converted to "%". */
 literal:
-		if (c != *bp++)
-			return (NULL);
+        if (c != *bp++)
+            return (NULL);
 
-		break;
+        break;
 
-		/*
-		 * "Alternative" modifiers. Just set the appropriate flag
-		 * and start over again.
-		 */
-		case 'E':	/* "%E?" alternative conversion modifier. */
-			_LEGAL_ALT(0);
-			alt_format |= _ALT_E;
-			goto again;
+        /*
+         * "Alternative" modifiers. Just set the appropriate flag
+         * and start over again.
+         */
+        case 'E':   /* "%E?" alternative conversion modifier. */
+            _LEGAL_ALT(0);
+            alt_format |= _ALT_E;
+            goto again;
 
-		case 'O':	/* "%O?" alternative conversion modifier. */
-			_LEGAL_ALT(0);
-			alt_format |= _ALT_O;
-			goto again;
-			
-		/*
-		 * "Complex" conversion rules, implemented through recursion.
-		 */
-		case 'c':	/* Date and time, using the locale's format. */
-			_LEGAL_ALT(_ALT_E);
-			if (!(bp = _strptime(bp, _ctloc(d_t_fmt), tm, 0)))
-				return (NULL);
-			break;
+        case 'O':   /* "%O?" alternative conversion modifier. */
+            _LEGAL_ALT(0);
+            alt_format |= _ALT_O;
+            goto again;
+            
+        /*
+         * "Complex" conversion rules, implemented through recursion.
+         */
+        case 'c':   /* Date and time, using the locale's format. */
+            _LEGAL_ALT(_ALT_E);
+            if (!(bp = _strptime(bp, _ctloc(d_t_fmt), tm, 0)))
+                return (NULL);
+            break;
 
-		case 'D':	/* The date as "%m/%d/%y". */
-			_LEGAL_ALT(0);
-			if (!(bp = _strptime(bp, "%m/%d/%y", tm, 0)))
-				return (NULL);
-			break;
-	
-		case 'R':	/* The time as "%H:%M". */
-			_LEGAL_ALT(0);
-			if (!(bp = _strptime(bp, "%H:%M", tm, 0)))
-				return (NULL);
-			break;
+        case 'D':   /* The date as "%m/%d/%y". */
+            _LEGAL_ALT(0);
+            if (!(bp = _strptime(bp, "%m/%d/%y", tm, 0)))
+                return (NULL);
+            break;
+    
+        case 'R':   /* The time as "%H:%M". */
+            _LEGAL_ALT(0);
+            if (!(bp = _strptime(bp, "%H:%M", tm, 0)))
+                return (NULL);
+            break;
 
-		case 'r':	/* The time as "%I:%M:%S %p". */
-			_LEGAL_ALT(0);
-			if (!(bp = _strptime(bp, "%I:%M:%S %p", tm, 0)))
-				return (NULL);
-			break;
+        case 'r':   /* The time as "%I:%M:%S %p". */
+            _LEGAL_ALT(0);
+            if (!(bp = _strptime(bp, "%I:%M:%S %p", tm, 0)))
+                return (NULL);
+            break;
 
-		case 'T':	/* The time as "%H:%M:%S". */
-			_LEGAL_ALT(0);
-			if (!(bp = _strptime(bp, "%H:%M:%S", tm, 0)))
-				return (NULL);
-			break;
+        case 'T':   /* The time as "%H:%M:%S". */
+            _LEGAL_ALT(0);
+            if (!(bp = _strptime(bp, "%H:%M:%S", tm, 0)))
+                return (NULL);
+            break;
 
-		case 'X':	/* The time, using the locale's format. */
-			_LEGAL_ALT(_ALT_E);
-			if (!(bp = _strptime(bp, _ctloc(t_fmt), tm, 0)))
-				return (NULL);
-			break;
+        case 'X':   /* The time, using the locale's format. */
+            _LEGAL_ALT(_ALT_E);
+            if (!(bp = _strptime(bp, _ctloc(t_fmt), tm, 0)))
+                return (NULL);
+            break;
 
-		case 'x':	/* The date, using the locale's format. */
-			_LEGAL_ALT(_ALT_E);
-			if (!(bp = _strptime(bp, _ctloc(d_fmt), tm, 0)))
-				return (NULL);
-			break;
+        case 'x':   /* The date, using the locale's format. */
+            _LEGAL_ALT(_ALT_E);
+            if (!(bp = _strptime(bp, _ctloc(d_fmt), tm, 0)))
+                return (NULL);
+            break;
 
-		/*
-		 * "Elementary" conversion rules.
-		 */
-		case 'A':	/* The day of week, using the locale's form. */
-		case 'a':
-			_LEGAL_ALT(0);
-			for (i = 0; i < 7; i++) {
-				/* Full name. */
-				len = strlen(_ctloc(day[i]));
-				if (strncasecmp(_ctloc(day[i]), bp, len) == 0)
-					break;
+        /*
+         * "Elementary" conversion rules.
+         */
+        case 'A':   /* The day of week, using the locale's form. */
+        case 'a':
+            _LEGAL_ALT(0);
+            for (i = 0; i < 7; i++) {
+                /* Full name. */
+                len = strlen(_ctloc(day[i]));
+                if (strncasecmp(_ctloc(day[i]), (const char*)bp, len) == 0)
+                    break;
 
-				/* Abbreviated name. */
-				len = strlen(_ctloc(abday[i]));
-				if (strncasecmp(_ctloc(abday[i]), bp, len) == 0)
-					break;
-			}
+                /* Abbreviated name. */
+                len = strlen(_ctloc(abday[i]));
+                if (strncasecmp(_ctloc(abday[i]), (const char*)bp, len) == 0)
+                    break;
+            }
 
-			/* Nothing matched. */
-			if (i == 7)
-				return (NULL);
+            /* Nothing matched. */
+            if (i == 7)
+                return (NULL);
 
-			tm->tm_wday = i;
-			bp += len;
-			break;
+            tm->tm_wday = i;
+            bp += len;
+            break;
 
-		case 'B':	/* The month, using the locale's form. */
-		case 'b':
-		case 'h':
-			_LEGAL_ALT(0);
-			for (i = 0; i < 12; i++) {
-				/* Full name. */
-				len = strlen(_ctloc(mon[i]));
-				if (strncasecmp(_ctloc(mon[i]), bp, len) == 0)
-					break;
+        case 'B':   /* The month, using the locale's form. */
+        case 'b':
+        case 'h':
+            _LEGAL_ALT(0);
+            for (i = 0; i < 12; i++) {
+                /* Full name. */
+                len = strlen(_ctloc(mon[i]));
+                if (strncasecmp(_ctloc(mon[i]), (const char*)bp, len) == 0)
+                    break;
 
-				/* Abbreviated name. */
-				len = strlen(_ctloc(abmon[i]));
-				if (strncasecmp(_ctloc(abmon[i]), bp, len) == 0)
-					break;
-			}
+                /* Abbreviated name. */
+                len = strlen(_ctloc(abmon[i]));
+                if (strncasecmp(_ctloc(abmon[i]), (const char*)bp, len) == 0)
+                    break;
+            }
 
-			/* Nothing matched. */
-			if (i == 12)
-				return (NULL);
+            /* Nothing matched. */
+            if (i == 12)
+                return (NULL);
 
-			tm->tm_mon = i;
-			bp += len;
-			break;
+            tm->tm_mon = i;
+            bp += len;
+            break;
 
-		case 'C':	/* The century number. */
-			_LEGAL_ALT(_ALT_E);
-			if (!(_conv_num(&bp, &i, 0, 99)))
-				return (NULL);
+        case 'C':   /* The century number. */
+            _LEGAL_ALT(_ALT_E);
+            if (!(_conv_num(&bp, &i, 0, 99)))
+                return (NULL);
 
-			century = i * 100;
-			break;
+            century = i * 100;
+            break;
 
-		case 'd':	/* The day of month. */
-		case 'e':
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_mday, 1, 31)))
-				return (NULL);
-			break;
+        case 'd':   /* The day of month. */
+        case 'e':
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_mday, 1, 31)))
+                return (NULL);
+            break;
 
-		case 'k':	/* The hour (24-hour clock representation). */
-			_LEGAL_ALT(0);
-			/* FALLTHROUGH */
-		case 'H':
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_hour, 0, 23)))
-				return (NULL);
-			break;
+        case 'k':   /* The hour (24-hour clock representation). */
+            _LEGAL_ALT(0);
+            /* FALLTHROUGH */
+        case 'H':
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_hour, 0, 23)))
+                return (NULL);
+            break;
 
-		case 'l':	/* The hour (12-hour clock representation). */
-			_LEGAL_ALT(0);
-			/* FALLTHROUGH */
-		case 'I':
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_hour, 1, 12)))
-				return (NULL);
-			break;
+        case 'l':   /* The hour (12-hour clock representation). */
+            _LEGAL_ALT(0);
+            /* FALLTHROUGH */
+        case 'I':
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_hour, 1, 12)))
+                return (NULL);
+            break;
 
-		case 'j':	/* The day of year. */
-			_LEGAL_ALT(0);
-			if (!(_conv_num(&bp, &tm->tm_yday, 1, 366)))
-				return (NULL);
-			tm->tm_yday--;
-			break;
+        case 'j':   /* The day of year. */
+            _LEGAL_ALT(0);
+            if (!(_conv_num(&bp, &tm->tm_yday, 1, 366)))
+                return (NULL);
+            tm->tm_yday--;
+            break;
 
-		case 'M':	/* The minute. */
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_min, 0, 59)))
-				return (NULL);
-			break;
+        case 'M':   /* The minute. */
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_min, 0, 59)))
+                return (NULL);
+            break;
 
-		case 'm':	/* The month. */
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_mon, 1, 12)))
-				return (NULL);
-			tm->tm_mon--;
-			break;
+        case 'm':   /* The month. */
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_mon, 1, 12)))
+                return (NULL);
+            tm->tm_mon--;
+            break;
 
-		case 'p':	/* The locale's equivalent of AM/PM. */
-			_LEGAL_ALT(0);
-			/* AM? */
-			len = strlen(_ctloc(am_pm[0]));
-			if (strncasecmp(_ctloc(am_pm[0]), bp, len) == 0) {
-				if (tm->tm_hour > 12)	/* i.e., 13:00 AM ?! */
-					return (NULL);
-				else if (tm->tm_hour == 12)
-					tm->tm_hour = 0;
+        case 'p':   /* The locale's equivalent of AM/PM. */
+            _LEGAL_ALT(0);
+            /* AM? */
+            len = strlen(_ctloc(am_pm[0]));
+            if (strncasecmp(_ctloc(am_pm[0]), (const char*)bp, len) == 0) {
+                if (tm->tm_hour > 12)   /* i.e., 13:00 AM ?! */
+                    return (NULL);
+                else if (tm->tm_hour == 12)
+                    tm->tm_hour = 0;
 
-				bp += len;
-				break;
-			}
-			/* PM? */
-			len = strlen(_ctloc(am_pm[1]));
-			if (strncasecmp(_ctloc(am_pm[1]), bp, len) == 0) {
-				if (tm->tm_hour > 12)	/* i.e., 13:00 PM ?! */
-					return (NULL);
-				else if (tm->tm_hour < 12)
-					tm->tm_hour += 12;
+                bp += len;
+                break;
+            }
+            /* PM? */
+            len = strlen(_ctloc(am_pm[1]));
+            if (strncasecmp(_ctloc(am_pm[1]), (const char*)bp, len) == 0) {
+                if (tm->tm_hour > 12)   /* i.e., 13:00 PM ?! */
+                    return (NULL);
+                else if (tm->tm_hour < 12)
+                    tm->tm_hour += 12;
 
-				bp += len;
-				break;
-			}
+                bp += len;
+                break;
+            }
 
-			/* Nothing matched. */
-			return (NULL);
+            /* Nothing matched. */
+            return (NULL);
 
-		case 'S':	/* The seconds. */
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_sec, 0, 61)))
-				return (NULL);
-			break;
+        case 'S':   /* The seconds. */
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_sec, 0, 61)))
+                return (NULL);
+            break;
 
-		case 'U':	/* The week of year, beginning on sunday. */
-		case 'W':	/* The week of year, beginning on monday. */
-			_LEGAL_ALT(_ALT_O);
-			/*
-			 * XXX This is bogus, as we can not assume any valid
-			 * information present in the tm structure at this
-			 * point to calculate a real value, so just check the
-			 * range for now.
-			 */
-			 if (!(_conv_num(&bp, &i, 0, 53)))
-				return (NULL);
-			 break;
+        case 'U':   /* The week of year, beginning on sunday. */
+        case 'W':   /* The week of year, beginning on monday. */
+            _LEGAL_ALT(_ALT_O);
+            /*
+             * XXX This is bogus, as we can not assume any valid
+             * information present in the tm structure at this
+             * point to calculate a real value, so just check the
+             * range for now.
+             */
+             if (!(_conv_num(&bp, &i, 0, 53)))
+                return (NULL);
+             break;
 
-		case 'w':	/* The day of week, beginning on sunday. */
-			_LEGAL_ALT(_ALT_O);
-			if (!(_conv_num(&bp, &tm->tm_wday, 0, 6)))
-				return (NULL);
-			break;
+        case 'w':   /* The day of week, beginning on sunday. */
+            _LEGAL_ALT(_ALT_O);
+            if (!(_conv_num(&bp, &tm->tm_wday, 0, 6)))
+                return (NULL);
+            break;
 
-		case 'Y':	/* The year. */
-			_LEGAL_ALT(_ALT_E);
-			if (!(_conv_num(&bp, &i, 0, 9999)))
-				return (NULL);
+        case 'Y':   /* The year. */
+            _LEGAL_ALT(_ALT_E);
+            if (!(_conv_num(&bp, &i, 0, 9999)))
+                return (NULL);
 
-			relyear = -1;
-			tm->tm_year = i - TM_YEAR_BASE;
-			break;
+            relyear = -1;
+            tm->tm_year = i - TM_YEAR_BASE;
+            break;
 
-		case 'y':	/* The year within the century (2 digits). */
-			_LEGAL_ALT(_ALT_E | _ALT_O);
-			if (!(_conv_num(&bp, &relyear, 0, 99)))
-				return (NULL);
-			break;
+        case 'y':   /* The year within the century (2 digits). */
+            _LEGAL_ALT(_ALT_E | _ALT_O);
+            if (!(_conv_num(&bp, &relyear, 0, 99)))
+                return (NULL);
+            break;
 
-		/*
-		 * Miscellaneous conversions.
-		 */
-		case 'n':	/* Any kind of white-space. */
-		case 't':
-			_LEGAL_ALT(0);
-			while (isspace(*bp))
-				bp++;
-			break;
+        /*
+         * Miscellaneous conversions.
+         */
+        case 'n':   /* Any kind of white-space. */
+        case 't':
+            _LEGAL_ALT(0);
+            while (isspace(*bp))
+                bp++;
+            break;
 
 
-		default:	/* Unknown/unsupported conversion. */
-			return (NULL);
-		}
+        default:    /* Unknown/unsupported conversion. */
+            return (NULL);
+        }
 
 
-	}
+    }
 
-	/*
-	 * We need to evaluate the two digit year spec (%y)
-	 * last as we can get a century spec (%C) at any time.
-	 */
-	if (relyear != -1) {
-		if (century == TM_YEAR_BASE) {
-			if (relyear <= 68)
-				tm->tm_year = relyear + 2000 - TM_YEAR_BASE;
-			else
-				tm->tm_year = relyear + 1900 - TM_YEAR_BASE;
-		} else {
-			tm->tm_year = relyear + century - TM_YEAR_BASE;
-		}
-	}
+    /*
+     * We need to evaluate the two digit year spec (%y)
+     * last as we can get a century spec (%C) at any time.
+     */
+    if (relyear != -1) {
+        if (century == TM_YEAR_BASE) {
+            if (relyear <= 68)
+                tm->tm_year = relyear + 2000 - TM_YEAR_BASE;
+            else
+                tm->tm_year = relyear + 1900 - TM_YEAR_BASE;
+        } else {
+            tm->tm_year = relyear + century - TM_YEAR_BASE;
+        }
+    }
 
-	return ((char *)bp);
+    return (unsigned char*)bp;
 }
 
 
 static int
 _conv_num(const unsigned char **buf, int *dest, int llim, int ulim)
 {
-	int result = 0;
-	int rulim = ulim;
+    int result = 0;
+    int rulim = ulim;
 
-	if (**buf < '0' || **buf > '9')
-		return (0);
+    if (**buf < '0' || **buf > '9')
+        return (0);
 
-	/* we use rulim to break out of the loop when we run out of digits */
-	do {
-		result *= 10;
-		result += *(*buf)++ - '0';
-		rulim /= 10;
-	} while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9');
+    /* we use rulim to break out of the loop when we run out of digits */
+    do {
+        result *= 10;
+        result += *(*buf)++ - '0';
+        rulim /= 10;
+    } while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9');
 
-	if (result < llim || result > ulim)
-		return (0);
+    if (result < llim || result > ulim)
+        return (0);
 
-	*dest = result;
-	return (1);
+    *dest = result;
+    return (1);
 }
diff --git a/libc/tzcode/tzfile.h b/libc/tzcode/tzfile.h
index 480682e..f6c9a05 100644
--- a/libc/tzcode/tzfile.h
+++ b/libc/tzcode/tzfile.h
@@ -21,7 +21,7 @@
 
 #ifndef lint
 #ifndef NOID
-static char	tzfilehid[] = "@(#)tzfile.h	8.1";
+static char tzfilehid[] = "@(#)tzfile.h 8.1";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -34,54 +34,54 @@
 #endif /* !defined TZDIR */
 
 #ifndef TZDEFAULT
-#define TZDEFAULT	"localtime"
+#define TZDEFAULT   "localtime"
 #endif /* !defined TZDEFAULT */
 
 #ifndef TZDEFRULES
-#define TZDEFRULES	"posixrules"
+#define TZDEFRULES  "posixrules"
 #endif /* !defined TZDEFRULES */
 
 /*
 ** Each file begins with. . .
 */
 
-#define	TZ_MAGIC	"TZif"
+#define TZ_MAGIC    "TZif"
 
 struct tzhead {
-	char	tzh_magic[4];		/* TZ_MAGIC */
-	char	tzh_version[1];		/* '\0' or '2' as of 2005 */
-	char	tzh_reserved[15];	/* reserved--must be zero */
-	char	tzh_ttisgmtcnt[4];	/* coded number of trans. time flags */
-	char	tzh_ttisstdcnt[4];	/* coded number of trans. time flags */
-	char	tzh_leapcnt[4];		/* coded number of leap seconds */
-	char	tzh_timecnt[4];		/* coded number of transition times */
-	char	tzh_typecnt[4];		/* coded number of local time types */
-	char	tzh_charcnt[4];		/* coded number of abbr. chars */
+    char    tzh_magic[4];       /* TZ_MAGIC */
+    char    tzh_version[1];     /* '\0' or '2' as of 2005 */
+    char    tzh_reserved[15];   /* reserved--must be zero */
+    char    tzh_ttisgmtcnt[4];  /* coded number of trans. time flags */
+    char    tzh_ttisstdcnt[4];  /* coded number of trans. time flags */
+    char    tzh_leapcnt[4];     /* coded number of leap seconds */
+    char    tzh_timecnt[4];     /* coded number of transition times */
+    char    tzh_typecnt[4];     /* coded number of local time types */
+    char    tzh_charcnt[4];     /* coded number of abbr. chars */
 };
 
 /*
 ** . . .followed by. . .
 **
-**	tzh_timecnt (char [4])s		coded transition times a la time(2)
-**	tzh_timecnt (unsigned char)s	types of local time starting at above
-**	tzh_typecnt repetitions of
-**		one (char [4])		coded UTC offset in seconds
-**		one (unsigned char)	used to set tm_isdst
-**		one (unsigned char)	that's an abbreviation list index
-**	tzh_charcnt (char)s		'\0'-terminated zone abbreviations
-**	tzh_leapcnt repetitions of
-**		one (char [4])		coded leap second transition times
-**		one (char [4])		total correction after above
-**	tzh_ttisstdcnt (char)s		indexed by type; if TRUE, transition
-**					time is standard time, if FALSE,
-**					transition time is wall clock time
-**					if absent, transition times are
-**					assumed to be wall clock time
-**	tzh_ttisgmtcnt (char)s		indexed by type; if TRUE, transition
-**					time is UTC, if FALSE,
-**					transition time is local time
-**					if absent, transition times are
-**					assumed to be local time
+**  tzh_timecnt (char [4])s     coded transition times a la time(2)
+**  tzh_timecnt (unsigned char)s    types of local time starting at above
+**  tzh_typecnt repetitions of
+**      one (char [4])      coded UTC offset in seconds
+**      one (unsigned char) used to set tm_isdst
+**      one (unsigned char) that's an abbreviation list index
+**  tzh_charcnt (char)s     '\0'-terminated zone abbreviations
+**  tzh_leapcnt repetitions of
+**      one (char [4])      coded leap second transition times
+**      one (char [4])      total correction after above
+**  tzh_ttisstdcnt (char)s      indexed by type; if TRUE, transition
+**                  time is standard time, if FALSE,
+**                  transition time is wall clock time
+**                  if absent, transition times are
+**                  assumed to be wall clock time
+**  tzh_ttisgmtcnt (char)s      indexed by type; if TRUE, transition
+**                  time is UTC, if FALSE,
+**                  transition time is local time
+**                  if absent, transition times are
+**                  assumed to be local time
 */
 
 /*
@@ -100,81 +100,81 @@
 */
 
 #ifndef TZ_MAX_TIMES
-#define TZ_MAX_TIMES	1200
+#define TZ_MAX_TIMES    1200
 #endif /* !defined TZ_MAX_TIMES */
 
 #ifndef TZ_MAX_TYPES
 #ifndef NOSOLAR
-#define TZ_MAX_TYPES	256 /* Limited by what (unsigned char)'s can hold */
+#define TZ_MAX_TYPES    256 /* Limited by what (unsigned char)'s can hold */
 #endif /* !defined NOSOLAR */
 #ifdef NOSOLAR
 /*
 ** Must be at least 14 for Europe/Riga as of Jan 12 1995,
 ** as noted by Earl Chew.
 */
-#define TZ_MAX_TYPES	20	/* Maximum number of local time types */
+#define TZ_MAX_TYPES    20  /* Maximum number of local time types */
 #endif /* !defined NOSOLAR */
 #endif /* !defined TZ_MAX_TYPES */
 
 #ifndef TZ_MAX_CHARS
-#define TZ_MAX_CHARS	50	/* Maximum number of abbreviation characters */
-				/* (limited by what unsigned chars can hold) */
+#define TZ_MAX_CHARS    50  /* Maximum number of abbreviation characters */
+                /* (limited by what unsigned chars can hold) */
 #endif /* !defined TZ_MAX_CHARS */
 
 #ifndef TZ_MAX_LEAPS
-#define TZ_MAX_LEAPS	50	/* Maximum number of leap second corrections */
+#define TZ_MAX_LEAPS    50  /* Maximum number of leap second corrections */
 #endif /* !defined TZ_MAX_LEAPS */
 
-#define SECSPERMIN	60
-#define MINSPERHOUR	60
-#define HOURSPERDAY	24
-#define DAYSPERWEEK	7
-#define DAYSPERNYEAR	365
-#define DAYSPERLYEAR	366
-#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY	((long) SECSPERHOUR * HOURSPERDAY)
-#define MONSPERYEAR	12
+#define SECSPERMIN  60
+#define MINSPERHOUR 60
+#define HOURSPERDAY 24
+#define DAYSPERWEEK 7
+#define DAYSPERNYEAR    365
+#define DAYSPERLYEAR    366
+#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
+#define SECSPERDAY  ((long) SECSPERHOUR * HOURSPERDAY)
+#define MONSPERYEAR 12
 
-#define TM_SUNDAY	0
-#define TM_MONDAY	1
-#define TM_TUESDAY	2
-#define TM_WEDNESDAY	3
-#define TM_THURSDAY	4
-#define TM_FRIDAY	5
-#define TM_SATURDAY	6
+#define TM_SUNDAY   0
+#define TM_MONDAY   1
+#define TM_TUESDAY  2
+#define TM_WEDNESDAY    3
+#define TM_THURSDAY 4
+#define TM_FRIDAY   5
+#define TM_SATURDAY 6
 
-#define TM_JANUARY	0
-#define TM_FEBRUARY	1
-#define TM_MARCH	2
-#define TM_APRIL	3
-#define TM_MAY		4
-#define TM_JUNE		5
-#define TM_JULY		6
-#define TM_AUGUST	7
-#define TM_SEPTEMBER	8
-#define TM_OCTOBER	9
-#define TM_NOVEMBER	10
-#define TM_DECEMBER	11
+#define TM_JANUARY  0
+#define TM_FEBRUARY 1
+#define TM_MARCH    2
+#define TM_APRIL    3
+#define TM_MAY      4
+#define TM_JUNE     5
+#define TM_JULY     6
+#define TM_AUGUST   7
+#define TM_SEPTEMBER    8
+#define TM_OCTOBER  9
+#define TM_NOVEMBER 10
+#define TM_DECEMBER 11
 
-#define TM_YEAR_BASE	1900
+#define TM_YEAR_BASE    1900
 
-#define EPOCH_YEAR	1970
-#define EPOCH_WDAY	TM_THURSDAY
+#define EPOCH_YEAR  1970
+#define EPOCH_WDAY  TM_THURSDAY
 
 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
 
 /*
 ** Since everything in isleap is modulo 400 (or a factor of 400), we know that
-**	isleap(y) == isleap(y % 400)
+**  isleap(y) == isleap(y % 400)
 ** and so
-**	isleap(a + b) == isleap((a + b) % 400)
+**  isleap(a + b) == isleap((a + b) % 400)
 ** or
-**	isleap(a + b) == isleap(a % 400 + b % 400)
+**  isleap(a + b) == isleap(a % 400 + b % 400)
 ** This is true even if % means modulo rather than Fortran remainder
 ** (which is allowed by C89 but not C99).
 ** We use this to avoid addition overflow problems.
 */
 
-#define isleap_sum(a, b)	isleap((a) % 400 + (b) % 400)
+#define isleap_sum(a, b)    isleap((a) % 400 + (b) % 400)
 
 #endif /* !defined TZFILE_H */
diff --git a/libstdc++/include/cstring b/libstdc++/include/cstring
index 4ff7a6f..80473cc 100644
--- a/libstdc++/include/cstring
+++ b/libstdc++/include/cstring
@@ -39,59 +39,28 @@
 
 namespace std
 {
-using ::memccpy;
 using ::memchr;
-using ::memrchr;
 using ::memcmp;
 using ::memcpy;
 using ::memmove;
 using ::memset;
-using ::memmem;
-// In string.h but not part of the std
-// using ::memswap;
-
-using ::index;
-using ::rindex;
-using ::strchr;
-using ::strrchr;
-
-using ::strlen;
-using ::strcmp;
-using ::strcpy;
 using ::strcat;
-
-using ::strcasecmp;
-using ::strncasecmp;
-using ::strdup;
-
-using ::strstr;
-using ::strcasestr;
-using ::strtok;
-using ::strtok_r;
-
+using ::strchr;
+using ::strcmp;
+using ::strcoll;
+using ::strcpy;
+using ::strcspn;
 using ::strerror;
-using ::strerror_r;
-
-using ::strnlen;
+using ::strlen;
 using ::strncat;
-using ::strndup;
 using ::strncmp;
 using ::strncpy;
-
-// In string.h but not part of the std
-// using ::strlcat;
-// using ::strlcpy;
-
-using ::strcspn;
 using ::strpbrk;
-using ::strsep;
+using ::strrchr;
 using ::strspn;
-
-using ::strsignal;
-
-using ::strcoll;
+using ::strstr;
+using ::strtok;
 using ::strxfrm;
-
 }  // namespace std
 
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSTRING__
