Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/date.c
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2015-09-04 00:48:58 +0300
committerJunio C Hamano <gitster@pobox.com>2015-09-04 01:42:18 +0300
commitdc6d782c5d2526b251061daffc3e74d15c8c7095 (patch)
treef78c12164f074845f311a2650e142f5dd3eea7ed /date.c
parentf3c1ba502628cf0b6e8674f07c3850b21f365965 (diff)
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 <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'date.c')
-rw-r--r--date.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/date.c b/date.c
index 8f9156909b..9f0a5ddf6c 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);