Fix approxidate("never") to always return 0
Commit af66366a9feb0194ed04b1f538998021ece268a8 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 <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Olivier Marin committed
Jun 17, 2008 at 18:34 UTC
8c6b57860d9be5f346c9589a08c9e7c04eeaf99b
1 file changed
+2
-4
date.c
+2
-4
@@ -682,10 +682,8 @@ static void date_am(struct tm *tm, int *num)
682
683
static void date_never(struct tm *tm, int *num)
684
{
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);
687
}
688
689
static const struct special {