From 99f6356e35b89446487bcdd787ed9b0657ae6b71 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 14 Jul 2012 04:16:04 +0000 Subject: Fix use of "clever" mktime 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 --- erts/emulator/beam/erl_time_sup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/emulator/beam/erl_time_sup.c b/erts/emulator/beam/erl_time_sup.c index 1d0735aa99..e6962a700b 100644 --- a/erts/emulator/beam/erl_time_sup.c +++ b/erts/emulator/beam/erl_time_sup.c @@ -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; } -- cgit v1.2.3