date: remove approxidate_relative()

When 29f4332e66 (Quit passing 'now' to date code, 2019-09-11) removed its timeval parameter, approxidate_relative() became equivalent to approxidate(). Convert its last two call sites and remove the redundant function. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Apr 8, 2023 at 11:35 UTC 8a7f0b666fc749166421669fba62b1000321bd26
3 files changed +2 -17
date.c
-14
@@ -1365,20 +1365,6 @@ static timestamp_t approxidate_str(const char *date,
1365 return (timestamp_t)update_tm(&tm, &now, 0);
1366 }
1367
1368 -timestamp_t approxidate_relative(const char *date)
1369 -{
1370 - struct timeval tv;
1371 - timestamp_t timestamp;
1372 - int offset;
1373 - int errors = 0;
1374 -
1375 - if (!parse_date_basic(date, &timestamp, &offset))
1376 - return timestamp;
1377 -
1378 - get_time(&tv);
1379 - return approxidate_str(date, (const struct timeval *) &tv, &errors);
1380 -}
1381 -
1368 timestamp_t approxidate_careful(const char *date, int *error_ret)
1369 {
1370 struct timeval tv;
date.h
-1
@@ -68,7 +68,6 @@ int parse_expiry_date(const char *date, timestamp_t *timestamp);
68 void datestamp(struct strbuf *out);
69 #define approxidate(s) approxidate_careful((s), NULL)
70 timestamp_t approxidate_careful(const char *, int *);
71 -timestamp_t approxidate_relative(const char *date);
71 int date_overflows(timestamp_t date);
72 time_t tm_to_time_t(const struct tm *tm);
73 #endif
t/helper/test-date.c
+2 -2
@@ -81,7 +81,7 @@ static void parse_approxidate(const char **argv)
81 {
82 for (; *argv; argv++) {
83 timestamp_t t;
84 - t = approxidate_relative(*argv);
84 + t = approxidate(*argv);
85 printf("%s -> %s\n", *argv, show_date(t, 0, DATE_MODE(ISO8601)));
86 }
87 }
@@ -90,7 +90,7 @@ static void parse_approx_timestamp(const char **argv)
90 {
91 for (; *argv; argv++) {
92 timestamp_t t;
93 - t = approxidate_relative(*argv);
93 + t = approxidate(*argv);
94 printf("%s -> %"PRItime"\n", *argv, t);
95 }
96 }