]> git.saurik.com Git - apple/libc.git/blame - stdtime/FreeBSD/tzfile.h.patch
Libc-763.11.tar.gz
[apple/libc.git] / stdtime / FreeBSD / tzfile.h.patch
CommitLineData
1f2f436a
A
1--- tzfile.h.orig 2010-01-15 00:06:58.000000000 -0800
2+++ tzfile.h 2010-01-15 00:07:28.000000000 -0800
3@@ -38,7 +38,11 @@ static char tzfilehid[] = "@(#)tzfile.h
b5d655f7
A
4 #endif /* !defined TZDIR */
5
6 #ifndef TZDEFAULT
7+#ifdef UNIFDEF_MOVE_LOCALTIME
8+#define TZDEFAULT "/var/db/timezone/localtime"
9+#else /* !UNIFDEF_MOVE_LOCALTIME */
10 #define TZDEFAULT "/etc/localtime"
11+#endif /* UNIFDEF_MOVE_LOCALTIME */
12 #endif /* !defined TZDEFAULT */
13
14 #ifndef TZDEFRULES
1f2f436a
A
15@@ -167,6 +171,20 @@ struct tzhead {
16
17 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
18
19+/*
20+** Since everything in isleap is modulo 400 (or a factor of 400), we know that
21+** isleap(y) == isleap(y % 400)
22+** and so
23+** isleap(a + b) == isleap((a + b) % 400)
24+** or
25+** isleap(a + b) == isleap(a % 400 + b % 400)
26+** This is true even if % means modulo rather than Fortran remainder
27+** (which is allowed by C89 but not C99).
28+** We use this to avoid addition overflow problems.
29+*/
30+
31+#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
32+
33 #ifndef USG
34
35 /*