diff options
author | Siri Hansen <[email protected]> | 2018-05-16 16:10:30 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-05-23 10:39:14 +0200 |
commit | 8aa64c90ddd20ec0ca8cc5fe92a6124324c51da5 (patch) | |
tree | 4faf98823094ebca7ba9c4a82834956b1c77bd1e /lib/kernel/src/logger_formatter.erl | |
parent | 58abc1e47e6f44c75ef8e86f973270c6e23e89f7 (diff) | |
download | otp-8aa64c90ddd20ec0ca8cc5fe92a6124324c51da5.tar.gz otp-8aa64c90ddd20ec0ca8cc5fe92a6124324c51da5.tar.bz2 otp-8aa64c90ddd20ec0ca8cc5fe92a6124324c51da5.zip |
Use system_time instead of monotonic_time as timestamp in logger
Diffstat (limited to 'lib/kernel/src/logger_formatter.erl')
-rw-r--r-- | lib/kernel/src/logger_formatter.erl | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/kernel/src/logger_formatter.erl b/lib/kernel/src/logger_formatter.erl index 602c666cc7..a19e7bbc73 100644 --- a/lib/kernel/src/logger_formatter.erl +++ b/lib/kernel/src/logger_formatter.erl @@ -197,16 +197,15 @@ truncate(String,Size) -> String end. -format_time(Timestamp,#{time_offset:=Offset,time_designator:=Des}) - when is_integer(Timestamp) -> - SysTime = Timestamp + erlang:time_offset(microsecond), +%% SysTime is the system time in microseconds +format_time(SysTime,#{time_offset:=Offset,time_designator:=Des}) + when is_integer(SysTime) -> calendar:system_time_to_rfc3339(SysTime,[{unit,microsecond}, {offset,Offset}, {time_designator,Des}]). -%% Assuming this is monotonic time in microseconds -timestamp_to_datetimemicro(Timestamp,Config) when is_integer(Timestamp) -> - SysTime = Timestamp + erlang:time_offset(microsecond), +%% SysTime is the system time in microseconds +timestamp_to_datetimemicro(SysTime,Config) when is_integer(SysTime) -> Micro = SysTime rem 1000000, Sec = SysTime div 1000000, UniversalTime = erlang:posixtime_to_universaltime(Sec), |