Skip to content

Commit

Permalink
#472 fixed CONVTIME finally (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanabi authored May 4, 2023
1 parent 8d42bff commit 29493ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/fbtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,17 @@ time_string_to_seconds(char *string, const char *format, const char **error)
if (!strptime(string, format, &otm))
goto timeformat_err;

/*
* strptime seems to always set tm_isdst = 0 which means DST is not in
* effect, which means dates impacted by DST will lose an hour when
* converted to UNIX timestamp by mktime and then back into a date
* string later.
*
* Setting this to -1 makes it use the timezone database to determine
* if DST should be used or not, and seems to fix the problem.
*/
otm.tm_isdst = -1;

return mktime(&otm);

/*
Expand Down

0 comments on commit 29493ca

Please sign in to comment.