From 019082fd45c032fc0617c8519b9d9cdf67e0b8b9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 6 Sep 2013 18:56:00 -0700 Subject: [PATCH] * zic.c (stringzone): Add support for perpetual DST. This causes zic to generate, e.g., TZ='WART4WARST,J1/0,J365/24' for perpetual DST in San Luis, Argentina. See . --- 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; }