]> git.saurik.com Git - apple/libc.git/blobdiff - stdtime/FreeBSD/tzfile.h
Libc-1158.1.2.tar.gz
[apple/libc.git] / stdtime / FreeBSD / tzfile.h
index 378d7ae606c6c04c8e00a3dd20d7b95a33829490..aff38e7fd7540633c9549615798c2fa4317eb278 100644 (file)
@@ -34,11 +34,19 @@ static char tzfilehid[] = "@(#)tzfile.h     7.14";
 */
 
 #ifndef TZDIR
+#ifdef UNIFDEF_TZDIR_SYMLINK
+#define TZDIR  "/var/db/timezone/zoneinfo" /* Time zone object file directory */
+#else /* !UNIFDEF_TZDIR_SYMLINK */
 #define TZDIR  "/usr/share/zoneinfo" /* Time zone object file directory */
+#endif /* UNIFDEF_TZDIR_SYMLINK */
 #endif /* !defined TZDIR */
 
 #ifndef TZDEFAULT
+#ifdef UNIFDEF_MOVE_LOCALTIME
+#define TZDEFAULT      "/var/db/timezone/localtime"
+#else /* !UNIFDEF_MOVE_LOCALTIME */
 #define TZDEFAULT      "/etc/localtime"
+#endif /* UNIFDEF_MOVE_LOCALTIME */
 #endif /* !defined TZDEFAULT */
 
 #ifndef TZDEFRULES
@@ -167,6 +175,20 @@ struct tzhead {
 
 #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)
+** and so
+**     isleap(a + b) == isleap((a + b) % 400)
+** or
+**     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)
+
 #ifndef USG
 
 /*