Skip to content

Commit

Permalink
date.c: use the local timezone if none specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Torvalds committed Apr 30, 2005
1 parent 1771039 commit eaa8512
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit eaa8512

Please sign in to comment.