summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@rabbitmq.com>2014-06-20 14:10:09 +0400
committerMichael Klishin <michael@rabbitmq.com>2014-06-20 14:10:09 +0400
commitb5347bb8a8ac06514a191da000a788a9bd08f46c (patch)
tree88ae5bb2c59adea9ec0e2cce6eb17609acbe08ba
parentc405c8c5192c9cb129831d0aa992f557bd4ac887 (diff)
downloadrabbitmq-server-b5347bb8a8ac06514a191da000a788a9bd08f46c.tar.gz
Format connected_at info item
-rw-r--r--src/rabbit_reader.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index a45871fb..e1b4dbef 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -1130,7 +1130,7 @@ ic(channel_max, #connection{channel_max = ChMax}) -> ChMax;
ic(client_properties, #connection{client_properties = CP}) -> CP;
ic(auth_mechanism, #connection{auth_mechanism = none}) -> none;
ic(auth_mechanism, #connection{auth_mechanism = {Name, _Mod}}) -> Name;
-ic(connected_at, #connection{connected_at = Timestamp}) -> Timestamp;
+ic(connected_at, #connection{connected_at = T}) -> timestamp_ms(T);
ic(Item, #connection{}) -> throw({bad_argument, Item}).
socket_info(Get, Select, #v1{sock = Sock}) ->
@@ -1173,6 +1173,11 @@ emit_stats(State) ->
_ -> State1
end.
+timestamp_ms(unknown) ->
+ unknown;
+timestamp_ms(Timestamp) ->
+ timer:now_diff(Timestamp, {0,0,0}) div 1000.
+
%% 1.0 stub
-ifdef(use_specs).
-spec(become_1_0/2 :: (non_neg_integer(), #v1{}) -> no_return()).