aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/error_logger_file_h.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-01-05 17:00:13 +0100
committerBjörn-Egil Dahlberg <[email protected]>2012-01-05 17:00:13 +0100
commit96477e4f9df5dfe6c16a897b6540d4b58a9a167d (patch)
tree2191ac23398cd7d30f1870d5fd636452f4aacb7d /lib/stdlib/src/error_logger_file_h.erl
parentf9ca630a95e1e2adb1b225bfb69e3101678183f3 (diff)
downloadotp-96477e4f9df5dfe6c16a897b6540d4b58a9a167d.tar.gz
otp-96477e4f9df5dfe6c16a897b6540d4b58a9a167d.tar.bz2
otp-96477e4f9df5dfe6c16a897b6540d4b58a9a167d.zip
stdlib: Use utc time as base in error logger
* All computer time should be in utc and converted to local when needed * Previous conversion used the depcrated calendar:local_time_to_universal_time/1
Diffstat (limited to 'lib/stdlib/src/error_logger_file_h.erl')
-rw-r--r--lib/stdlib/src/error_logger_file_h.erl21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/stdlib/src/error_logger_file_h.erl b/lib/stdlib/src/error_logger_file_h.erl
index ee4f0b3a51..db81d517a4 100644
--- a/lib/stdlib/src/error_logger_file_h.erl
+++ b/lib/stdlib/src/error_logger_file_h.erl
@@ -104,7 +104,7 @@ code_change(_OldVsn, State, _Extra) ->
%%% ------------------------------------------------------
tag_event(Event) ->
- {erlang:localtime(), Event}.
+ {erlang:universaltime(), Event}.
write_events(Fd, Events) -> write_events1(Fd, lists:reverse(Events)).
@@ -169,23 +169,18 @@ write_event(_, _) ->
maybe_utc(Time) ->
UTC = case application:get_env(sasl, utc_log) of
- {ok, Val} ->
- Val;
+ {ok, Val} -> Val;
undefined ->
%% Backwards compatible:
case application:get_env(stdlib, utc_log) of
- {ok, Val} ->
- Val;
- undefined ->
- false
+ {ok, Val} -> Val;
+ undefined -> false
end
end,
- if
- UTC =:= true ->
- {utc, calendar:local_time_to_universal_time(Time)};
- true ->
- Time
- end.
+ maybe_utc(Time, UTC).
+
+maybe_utc(Time, true) -> {utc, Time};
+maybe_utc(Time, _) -> calendar:universal_time_to_local_time(Time).
format_report(Rep) when is_list(Rep) ->
case string_p(Rep) of