Skip to content

Commit 8c6b578

Browse files
Olivier Maringitster
authored andcommitted
Fix approxidate("never") to always return 0
Commit af66366 introduced the keyword "never" to be used with approxidate() but defined it with a fixed date without taking care of timezone. As a result approxidate() will return a timestamp in the future with a negative timezone. With this patch, approxidate("never") always return 0 whatever your timezone is. Signed-off-by: Olivier Marin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1d9b265 commit 8c6b578

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

date.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,8 @@ static void date_am(struct tm *tm, int *num)
682682

683683
static void date_never(struct tm *tm, int *num)
684684
{
685-
tm->tm_mon = tm->tm_wday = tm->tm_yday
686-
= tm->tm_hour = tm->tm_min = tm->tm_sec = 0;
687-
tm->tm_year = 70;
688-
tm->tm_mday = 1;
685+
time_t n = 0;
686+
localtime_r(&n, tm);
689687
}
690688

691689
static const struct special {

0 commit comments

Comments
 (0)