Skip to content

Commit 8a7f0b6

Browse files
rscharfegitster
authored andcommitted
date: remove approxidate_relative()
When 29f4332 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 73876f4 commit 8a7f0b6

File tree

3 files changed

+2
-17
lines changed

3 files changed

+2
-17
lines changed

date.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,20 +1365,6 @@ static timestamp_t approxidate_str(const char *date,
13651365
return (timestamp_t)update_tm(&tm, &now, 0);
13661366
}
13671367

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-
13821368
timestamp_t approxidate_careful(const char *date, int *error_ret)
13831369
{
13841370
struct timeval tv;

date.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ int parse_expiry_date(const char *date, timestamp_t *timestamp);
6868
void datestamp(struct strbuf *out);
6969
#define approxidate(s) approxidate_careful((s), NULL)
7070
timestamp_t approxidate_careful(const char *, int *);
71-
timestamp_t approxidate_relative(const char *date);
7271
int date_overflows(timestamp_t date);
7372
time_t tm_to_time_t(const struct tm *tm);
7473
#endif

t/helper/test-date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void parse_approxidate(const char **argv)
8181
{
8282
for (; *argv; argv++) {
8383
timestamp_t t;
84-
t = approxidate_relative(*argv);
84+
t = approxidate(*argv);
8585
printf("%s -> %s\n", *argv, show_date(t, 0, DATE_MODE(ISO8601)));
8686
}
8787
}
@@ -90,7 +90,7 @@ static void parse_approx_timestamp(const char **argv)
9090
{
9191
for (; *argv; argv++) {
9292
timestamp_t t;
93-
t = approxidate_relative(*argv);
93+
t = approxidate(*argv);
9494
printf("%s -> %"PRItime"\n", *argv, t);
9595
}
9696
}

0 commit comments

Comments
 (0)