+2017-01-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ strftime: %z is -00 if unknown
+ * lib/strftime.c (DO_TZ_OFFSET): Omit arg 'negative'; it's now
+ the caller's responsibility to set 'negative_number'. All uses changed.
+ (__strftime_internal): Put '-' before a zero UTC offset if the time
+ zone abbreviation starts with "-", which is the recently-introduced
+ tzdb convention for an unknown UTC offset that is arbitrarily set to 0.
+ * tests/test-strftime.c: Test for this.
+
2017-01-10 Paul Eggert <eggert@cs.ucla.edu>
dfa: port to older GCC
/* The mask is not what you might think.
When the ordinal i'th bit is set, insert a colon
before the i'th digit of the time zone representation. */
-#define DO_TZ_OFFSET(d, negative, mask, v) \
+#define DO_TZ_OFFSET(d, mask, v) \
do \
{ \
digits = d; \
- negative_number = negative; \
tz_colon_mask = mask; \
u_number_value = v; \
goto do_tz_offset; \
}
#endif
+ negative_number = diff < 0 || (diff == 0 && *zone == '-');
hour_diff = diff / 60 / 60;
min_diff = diff / 60 % 60;
sec_diff = diff % 60;
switch (colons)
{
case 0: /* +hhmm */
- DO_TZ_OFFSET (5, diff < 0, 0, hour_diff * 100 + min_diff);
+ DO_TZ_OFFSET (5, 0, hour_diff * 100 + min_diff);
case 1: tz_hh_mm: /* +hh:mm */
- DO_TZ_OFFSET (6, diff < 0, 04, hour_diff * 100 + min_diff);
+ DO_TZ_OFFSET (6, 04, hour_diff * 100 + min_diff);
case 2: tz_hh_mm_ss: /* +hh:mm:ss */
- DO_TZ_OFFSET (9, diff < 0, 024,
+ DO_TZ_OFFSET (9, 024,
hour_diff * 10000 + min_diff * 100 + sec_diff);
case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */
goto tz_hh_mm_ss;
if (min_diff != 0)
goto tz_hh_mm;
- DO_TZ_OFFSET (3, diff < 0, 0, hour_diff);
+ DO_TZ_OFFSET (3, 0, hour_diff);
default:
goto bad_format;
{ 0, "JST-9" },
#define NZ 5
{ 0, "NZST-12NZDT,M9.5.0,M4.1.0/3" },
+#define Unknown 6
+ { 0, "<-00>0" },
{ 0 }
};
{ TZ+CentEur, 0, "1970-01-01 01:00:00 +0100 (CET)", 0 },
{ TZ+Japan , 0, "1970-01-01 09:00:00 +0900 (JST)", 0 },
{ TZ+NZ , 0, "1970-01-01 13:00:00 +1300 (NZDT)", 1 },
+ { TZ+Unknown, 0, "1970-01-01 00:00:00 -0000 (-00)", 0 },
{ TZ+Pacific, 500000001, "1985-11-04 16:53:21 -0800 (PST)", 0 },
{ TZ+Arizona, 500000001, "1985-11-04 17:53:21 -0700 (MST)", 0 },
{ TZ+UTC , 500000001, "1985-11-05 00:53:21 +0000 (UTC)", 0 },
{ TZ+CentEur, 500000001, "1985-11-05 01:53:21 +0100 (CET)", 1 },
{ TZ+Japan , 500000001, "1985-11-05 09:53:21 +0900 (JST)", 0 },
{ TZ+NZ , 500000001, "1985-11-05 13:53:21 +1300 (NZDT)", 0 },
+ { TZ+Unknown, 500000001, "1985-11-05 00:53:21 -0000 (-00)", 0 },
{ TZ+Pacific, 1000000002, "2001-09-08 18:46:42 -0700 (PDT)", 0 },
{ TZ+Arizona, 1000000002, "2001-09-08 18:46:42 -0700 (MST)", 0 },
{ TZ+UTC , 1000000002, "2001-09-09 01:46:42 +0000 (UTC)", 0 },
{ TZ+CentEur, 1000000002, "2001-09-09 03:46:42 +0200 (CEST)", 0 },
{ TZ+Japan , 1000000002, "2001-09-09 10:46:42 +0900 (JST)", 0 },
{ TZ+NZ , 1000000002, "2001-09-09 13:46:42 +1200 (NZST)", 0 },
+ { TZ+Unknown, 1000000002, "2001-09-09 01:46:42 -0000 (-00)", 0 },
{ 0 }
};