fix: retainer message format time by rfc3339 (#5607)

* fix: retainer message format time by rfc3339
This commit is contained in:
DDDHuang 2021-08-31 10:24:17 +08:00 committed by GitHub
parent 5b75fdd120
commit caef8cb381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -46,9 +46,9 @@ message_props() ->
{topic, string, <<"MQTT Topic">>},
{qos, string, <<"MQTT QoS">>},
{payload, string, <<"MQTT Payload">>},
{publish_at, string, <<"publish datetime">>},
{from_clientid, string, <<"publisher ClientId">>},
{from_username, string, <<"publisher Username">>}
{publish_at, string, <<"Publish datetime, in RFC 3339 format">>},
{from_clientid, string, <<"Publisher ClientId">>},
{from_username, string, <<"Publisher Username">>}
]).
parameters() ->
@ -170,7 +170,7 @@ format_message(#message{id = ID, qos = Qos, topic = Topic, from = From, timestam
#{msgid => emqx_guid:to_hexstr(ID),
qos => Qos,
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_username => maps:get(username, Headers, <<>>)
}.