diff --git a/date.c b/date.c index 8f9156909..9f0a5ddf6 100644 --- a/date.c +++ b/date.c @@ -174,6 +174,9 @@ const char *show_date(unsigned long time, int tz, const struct date_mode *mode) struct tm *tm; static struct strbuf timebuf = STRBUF_INIT; + if (mode->type == DATE_LOCAL) + tz = local_tzoffset(time); + if (mode->type == DATE_RAW) { strbuf_reset(&timebuf); 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) return timebuf.buf; } - if (mode->type == DATE_LOCAL) - tz = local_tzoffset(time); - tm = time_to_tm(time, tz); if (!tm) { tm = time_to_tm(0, 0);