From: Linus Torvalds Date: Sat, 30 Apr 2005 21:25:02 +0000 (-0700) Subject: date.c: use the local timezone if none specified X-Git-Tag: v0.99~685 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=eaa85129230e568757b39b965beee513c8106b37;p=git.git date.c: use the local timezone if none specified --- diff --git a/date.c b/date.c index b59e832d..ffa4246a 100644 --- a/date.c +++ b/date.c @@ -245,7 +245,8 @@ void parse_date(char *date, char *result, int maxlen) tm.tm_year = -1; tm.tm_mon = -1; tm.tm_mday = -1; - offset = 0; + tm.tm_isdst = -1; + offset = -1; for (;;) { int match = 0; @@ -270,7 +271,11 @@ void parse_date(char *date, char *result, int maxlen) date += match; } - then = my_mktime(&tm); /* mktime uses local timezone */ + /* mktime uses local timezone */ + then = my_mktime(&tm); + if (offset == -1) + offset = (then - mktime(&tm)) / 60; + if (then == -1) return;