summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_error_logger.erl3
-rw-r--r--src/rabbit_misc.erl8
2 files changed, 9 insertions, 2 deletions
diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl
index 0120f0d6..33dfcef9 100644
--- a/src/rabbit_error_logger.erl
+++ b/src/rabbit_error_logger.erl
@@ -69,6 +69,7 @@ publish(_Other, _Format, _Data, _State) ->
publish1(RoutingKey, Format, Data, LogExch) ->
{ok, _RoutingRes, _DeliveredQPids} =
rabbit_basic:publish(LogExch, RoutingKey, false, false, none,
- #'P_basic'{content_type = <<"text/plain">>},
+ #'P_basic'{content_type = <<"text/plain">>,
+ timestamp = rabbit_misc:timestamp()},
list_to_binary(io_lib:format(Format, Data))),
ok.
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index e79a58a1..713498c8 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -52,7 +52,7 @@
unlink_and_capture_exit/1]).
-export([get_options/2]).
-export([all_module_attributes/1, build_acyclic_graph/3]).
--export([now_ms/0]).
+-export([now_ms/0, timestamp/0]).
-export([lock_file/1]).
-export([const_ok/1, const/1]).
-export([ntoa/1, ntoab/1]).
@@ -190,6 +190,7 @@
{bad_edge, [digraph:vertex()]}),
digraph:vertex(), digraph:vertex()})).
-spec(now_ms/0 :: () -> non_neg_integer()).
+-spec(timestamp/0 ::() -> non_neg_integer()).
-spec(lock_file/1 :: (file:filename()) -> rabbit_types:ok_or_error('eexist')).
-spec(const_ok/1 :: (any()) -> 'ok').
-spec(const/1 :: (A) -> const(A)).
@@ -199,6 +200,7 @@
-endif.
+-define(EPOCH, {{1970, 1, 1}, {0, 0, 0}}).
%%----------------------------------------------------------------------------
method_record_type(Record) ->
@@ -791,6 +793,10 @@ get_flag(_, []) ->
now_ms() ->
timer:now_diff(now(), {0,0,0}) div 1000.
+timestamp() ->
+ calendar:datetime_to_gregorian_seconds(erlang:universaltime()) -
+ calendar:datetime_to_gregorian_seconds(?EPOCH).
+
module_attributes(Module) ->
case catch Module:module_info(attributes) of
{'EXIT', {undef, [{Module, module_info, _} | _]}} ->