fix: retainer message format time by rfc3339 (#5607)
* fix: retainer message format time by rfc3339
This commit is contained in:
parent
5b75fdd120
commit
caef8cb381
|
@ -46,9 +46,9 @@ message_props() ->
|
||||||
{topic, string, <<"MQTT Topic">>},
|
{topic, string, <<"MQTT Topic">>},
|
||||||
{qos, string, <<"MQTT QoS">>},
|
{qos, string, <<"MQTT QoS">>},
|
||||||
{payload, string, <<"MQTT Payload">>},
|
{payload, string, <<"MQTT Payload">>},
|
||||||
{publish_at, string, <<"publish datetime">>},
|
{publish_at, string, <<"Publish datetime, in RFC 3339 format">>},
|
||||||
{from_clientid, string, <<"publisher ClientId">>},
|
{from_clientid, string, <<"Publisher ClientId">>},
|
||||||
{from_username, string, <<"publisher Username">>}
|
{from_username, string, <<"Publisher Username">>}
|
||||||
]).
|
]).
|
||||||
|
|
||||||
parameters() ->
|
parameters() ->
|
||||||
|
@ -170,7 +170,7 @@ format_message(#message{id = ID, qos = Qos, topic = Topic, from = From, timestam
|
||||||
#{msgid => emqx_guid:to_hexstr(ID),
|
#{msgid => emqx_guid:to_hexstr(ID),
|
||||||
qos => Qos,
|
qos => Qos,
|
||||||
topic => Topic,
|
topic => Topic,
|
||||||
publish_at => erlang:list_to_binary(emqx_mgmt_util:strftime(Timestamp div 1000)),
|
publish_at => list_to_binary(calendar:system_time_to_rfc3339(Timestamp, [{unit, millisecond}])),
|
||||||
from_clientid => to_bin_string(From),
|
from_clientid => to_bin_string(From),
|
||||||
from_username => maps:get(username, Headers, <<>>)
|
from_username => maps:get(username, Headers, <<>>)
|
||||||
}.
|
}.
|
||||||
|
|
Loading…
Reference in New Issue