diff mbox series

[5/8] show_date_relative(): drop unused "tz" parameter

Message ID 20190124131221.GE22398@sigill.intra.peff.net (mailing list archive)
State New, archived
Headers show
Series drop some unused parameters | expand

Commit Message

Jeff King Jan. 24, 2019, 1:12 p.m. UTC
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>
---
 cache.h              | 2 +-
 date.c               | 8 ++++----
 t/helper/test-date.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Derrick Stolee Jan. 24, 2019, 2:07 p.m. UTC | #1
On 1/24/2019 8:12 AM, Jeff King wrote:
> 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.
I fully support more humor in our commit messages.

-Stolee
diff mbox series

Patch

diff --git a/cache.h b/cache.h
index 49713cc5a5..8d97939c0d 100644
--- a/cache.h
+++ b/cache.h
@@ -1464,7 +1464,7 @@  struct date_mode {
 struct date_mode *date_mode_from_type(enum date_mode_type type);
 
 const char *show_date(timestamp_t time, int timezone, const struct date_mode *mode);
-void show_date_relative(timestamp_t time, int tz, const struct timeval *now,
+void show_date_relative(timestamp_t time, const struct timeval *now,
 			struct strbuf *timebuf);
 int parse_date(const char *date, struct strbuf *out);
 int parse_date_basic(const char *date, timestamp_t *timestamp, int *offset);
diff --git a/date.c b/date.c
index 9bc15df6f9..61449f8b2e 100644
--- a/date.c
+++ b/date.c
@@ -107,9 +107,9 @@  static int local_tzoffset(timestamp_t time)
 	return offset * eastwest;
 }
 
-void show_date_relative(timestamp_t time, int tz,
-			       const struct timeval *now,
-			       struct strbuf *timebuf)
+void show_date_relative(timestamp_t time,
+			const struct timeval *now,
+			struct strbuf *timebuf)
 {
 	timestamp_t diff;
 	if (now->tv_sec < time) {
@@ -216,7 +216,7 @@  const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
 
 		strbuf_reset(&timebuf);
 		gettimeofday(&now, NULL);
-		show_date_relative(time, tz, &now, &timebuf);
+		show_date_relative(time, &now, &timebuf);
 		return timebuf.buf;
 	}
 
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index a0837371ab..aac4d542c2 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -16,7 +16,7 @@  static void show_relative_dates(const char **argv, struct timeval *now)
 
 	for (; *argv; argv++) {
 		time_t t = atoi(*argv);
-		show_date_relative(t, 0, now, &buf);
+		show_date_relative(t, now, &buf);
 		printf("%s -> %s\n", *argv, buf.buf);
 	}
 	strbuf_release(&buf);