show_date_relative(): drop unused "tz" parameter

The timestamp we receive is in epoch time, so there's no need for a timezone parameter to interpret it. The matching show_date() uses "tz" to show dates in author local time, but relative dates show only the absolute time difference. The author's location is irrelevant, barring relativistic effects from using Git close to the speed of light. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jan 24, 2019 at 08:12 UTC 3d42034a18297bc014e2132121c4854f5a07fe4c
3 files changed +6 -6
cache.h
+1 -1
@@ -1464,7 +1464,7 @@ struct date_mode {
1464 struct date_mode *date_mode_from_type(enum date_mode_type type);
1465
1466 const char *show_date(timestamp_t time, int timezone, const struct date_mode *mode);
1467 -void show_date_relative(timestamp_t time, int tz, const struct timeval *now,
1467 +void show_date_relative(timestamp_t time, const struct timeval *now,
1468 struct strbuf *timebuf);
1469 int parse_date(const char *date, struct strbuf *out);
1470 int parse_date_basic(const char *date, timestamp_t *timestamp, int *offset);
date.c
+4 -4
@@ -107,9 +107,9 @@ static int local_tzoffset(timestamp_t time)
107 return offset * eastwest;
108 }
109
110 -void show_date_relative(timestamp_t time, int tz,
111 - const struct timeval *now,
112 - struct strbuf *timebuf)
110 +void show_date_relative(timestamp_t time,
111 + const struct timeval *now,
112 + struct strbuf *timebuf)
113 {
114 timestamp_t diff;
115 if (now->tv_sec < time) {
@@ -216,7 +216,7 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
216
217 strbuf_reset(&timebuf);
218 gettimeofday(&now, NULL);
219 - show_date_relative(time, tz, &now, &timebuf);
219 + show_date_relative(time, &now, &timebuf);
220 return timebuf.buf;
221 }
222
t/helper/test-date.c
+1 -1
@@ -16,7 +16,7 @@ static void show_relative_dates(const char **argv, struct timeval *now)
16
17 for (; *argv; argv++) {
18 time_t t = atoi(*argv);
19 - show_date_relative(t, 0, now, &buf);
19 + show_date_relative(t, now, &buf);
20 printf("%s -> %s\n", *argv, buf.buf);
21 }
22 strbuf_release(&buf);