[tz] [PATCH] * zic.c (stringzone): Add support for perpetual DST.

Paul Eggert eggert at cs.ucla.edu
Sat Sep 7 01:57:32 UTC 2013


This causes zic to generate, e.g., TZ='WART4WARST,J1/0,J365/24'
for perpetual DST in San Luis, Argentina.
See <http://mm.icann.org/pipermail/tz/2013-September/020056.html>.
---
 zic.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/zic.c b/zic.c
index 260dc2e..502d81e 100644
--- a/zic.c
+++ b/zic.c
@@ -1886,7 +1886,7 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount)
 					stdrp = rp;
 		}
 		if (stdrp != NULL && stdrp->r_stdoff != 0)
-			return;	/* We end up in DST (a POSIX no-no). */
+			dstrp = stdrp; /* We end up in DST.  */
 		/*
 		** Horrid special case: if year is 2037,
 		** presume this is a zone handled on a year-by-year basis;
@@ -1913,12 +1913,16 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount)
 				return;
 		}
 	(void) strcat(result, ",");
-	if (stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) {
+	if (dstrp == stdrp)
+		(void) strcat(result, "J1/0");
+	else if (stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) {
 		result[0] = '\0';
 		return;
 	}
 	(void) strcat(result, ",");
-	if (stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) {
+	if (dstrp == stdrp)
+		(void) strcat(result, "J365/24");
+	else if (stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) {
 		result[0] = '\0';
 		return;
 	}
-- 
1.8.1.2




More information about the tz mailing list