1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 22:56:07 +02:00

Add "Z" as an alias for the timezone "UTC"

The name "Z" for the UTC timezone is required to properly parse ISO 8601
timestamps.  Add it to the list of recognized timezones.

Because timezone names can be shorter than 3 letters, loosen the
restriction in match_alpha() that used to require at least 3 letters to
match to allow a short timezone name as long as it matches exactly.  Prior
to the introduction of the "Z" zone, this already affected the timezone
"NT" (Nome).

Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
Reviewed-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Marcus Comstedt 2010-05-17 21:07:10 +02:00 committed by Junio C Hamano
parent 3368edd4cd
commit 75b37e7047

3
date.c
View File

@ -229,6 +229,7 @@ static const struct {
{ "GMT", 0, 0, }, /* Greenwich Mean */
{ "UTC", 0, 0, }, /* Universal (Coordinated) */
{ "Z", 0, 0, }, /* Zulu, alias for UTC */
{ "WET", 0, 0, }, /* Western European */
{ "BST", 0, 1, }, /* British Summer */
@ -305,7 +306,7 @@ static int match_alpha(const char *date, struct tm *tm, int *offset)
for (i = 0; i < ARRAY_SIZE(timezone_names); i++) {
int match = match_string(date, timezone_names[i].name);
if (match >= 3) {
if (match >= 3 || match == strlen(timezone_names[i].name)) {
int off = timezone_names[i].offset;
/* This is bogus, but we like summer */