Git fork

Merge branch 'bb/iso-strict-utc'

The output format for dates "iso-strict" has been tweaked to show
a time in the Zulu timezone with "Z" suffix, instead of "+00:00".

* bb/iso-strict-utc:
date: make "iso-strict" conforming for the UTC timezone

+10 -5
+9 -5
date.c
··· 342 342 tm->tm_hour, tm->tm_min, tm->tm_sec, 343 343 tz); 344 344 else if (mode->type == DATE_ISO8601_STRICT) { 345 - char sign = (tz >= 0) ? '+' : '-'; 346 - tz = abs(tz); 347 - strbuf_addf(&timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d", 345 + strbuf_addf(&timebuf, "%04d-%02d-%02dT%02d:%02d:%02d", 348 346 tm->tm_year + 1900, 349 347 tm->tm_mon + 1, 350 348 tm->tm_mday, 351 - tm->tm_hour, tm->tm_min, tm->tm_sec, 352 - sign, tz / 100, tz % 100); 349 + tm->tm_hour, tm->tm_min, tm->tm_sec); 350 + if (tz == 0) { 351 + strbuf_addch(&timebuf, 'Z'); 352 + } else { 353 + strbuf_addch(&timebuf, tz >= 0 ? '+' : '-'); 354 + tz = abs(tz); 355 + strbuf_addf(&timebuf, "%02d:%02d", tz / 100, tz % 100); 356 + } 353 357 } else if (mode->type == DATE_RFC2822) 354 358 strbuf_addf(&timebuf, "%.3s, %d %.3s %d %02d:%02d:%02d %+05d", 355 359 weekday_names[tm->tm_wday], tm->tm_mday,
+1
t/t0006-date.sh
··· 46 46 TIME='1466000000 +0200' 47 47 check_show iso8601 "$TIME" '2016-06-15 16:13:20 +0200' 48 48 check_show iso8601-strict "$TIME" '2016-06-15T16:13:20+02:00' 49 + check_show iso8601-strict "$(echo "$TIME" | sed 's/+0200$/+0000/')" '2016-06-15T14:13:20Z' 49 50 check_show rfc2822 "$TIME" 'Wed, 15 Jun 2016 16:13:20 +0200' 50 51 check_show short "$TIME" '2016-06-15' 51 52 check_show default "$TIME" 'Wed Jun 15 16:13:20 2016 +0200'