Skip to content

Commit dc6d782

Browse files
johnkeepinggitster
authored andcommitted
date: check for "local" before anything else
In a following commit we will make "local" orthogonal to the format. Although this will not apply to "relative", which does not use the timezone, it applies to all other formats so move the timezone conversion to the start of the function. Signed-off-by: John Keeping <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f3c1ba5 commit dc6d782

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ const char *show_date(unsigned long time, int tz, const struct date_mode *mode)
174174
struct tm *tm;
175175
static struct strbuf timebuf = STRBUF_INIT;
176176

177+
if (mode->type == DATE_LOCAL)
178+
tz = local_tzoffset(time);
179+
177180
if (mode->type == DATE_RAW) {
178181
strbuf_reset(&timebuf);
179182
strbuf_addf(&timebuf, "%lu %+05d", time, tz);
@@ -189,9 +192,6 @@ const char *show_date(unsigned long time, int tz, const struct date_mode *mode)
189192
return timebuf.buf;
190193
}
191194

192-
if (mode->type == DATE_LOCAL)
193-
tz = local_tzoffset(time);
194-
195195
tm = time_to_tm(time, tz);
196196
if (!tm) {
197197
tm = time_to_tm(0, 0);

0 commit comments

Comments
 (0)