Skip to content

Commit

Permalink
Fix use of "clever" mktime
Browse files Browse the repository at this point in the history
Commit 1eef765 introduced regression (conditional _always_ evaluates
to true) in which erlang:localtime_to_universaltime/2 stopped working
on systems configured with timezone without DST (i.e. UTC) on *BSD
platforms:

1> erlang:localtime_to_universaltime({{2012,1,1},{0,0,0}}, true).
** exception error: bad argument

Signed-off-by: Piotr Sikora <piotr.sikora@frickle.com>
  • Loading branch information
PiotrSikora authored and proxyles committed Aug 1, 2012
1 parent ffcdf6f commit 99f6356
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion erts/emulator/beam/erl_time_sup.c
Expand Up @@ -757,7 +757,7 @@ local_to_univ(Sint *year, Sint *month, Sint *day,
refuses to give us a DST time, we simulate the Linux/Solaris
behaviour of giving the same data as if is_dst was not set. */
t.tm_isdst = 0;
if (erl_mktime(&the_clock, &t)) {
if (erl_mktime(&the_clock, &t) < 0) {
/* Failed anyway, something else is bad - will be a badarg */
return 0;
}
Expand Down

0 comments on commit 99f6356

Please sign in to comment.