Change the message timestamp to 'os:timestamp()'
This commit is contained in:
parent
9e0b2ed57b
commit
0019fb2b49
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
|
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io)
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -15,8 +15,11 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
%% @doc MQTT Message Functions
|
%% @doc MQTT Message Functions
|
||||||
|
|
||||||
-module(emqttd_message).
|
-module(emqttd_message).
|
||||||
|
|
||||||
|
-author("Feng Lee <feng@emqtt.io>").
|
||||||
|
|
||||||
-include("emqttd.hrl").
|
-include("emqttd.hrl").
|
||||||
|
|
||||||
-include("emqttd_protocol.hrl").
|
-include("emqttd_protocol.hrl").
|
||||||
|
@ -42,7 +45,7 @@ make(From, Qos, Topic, Payload) ->
|
||||||
qos = ?QOS_I(Qos),
|
qos = ?QOS_I(Qos),
|
||||||
topic = Topic,
|
topic = Topic,
|
||||||
payload = Payload,
|
payload = Payload,
|
||||||
timestamp = emqttd_time:now_to_secs()}.
|
timestamp = os:timestamp()}.
|
||||||
|
|
||||||
%% @doc Message from Packet
|
%% @doc Message from Packet
|
||||||
-spec(from_packet(mqtt_packet()) -> mqtt_message()).
|
-spec(from_packet(mqtt_packet()) -> mqtt_message()).
|
||||||
|
@ -60,7 +63,7 @@ from_packet(#mqtt_packet{header = #mqtt_packet_header{type = ?PUBLISH,
|
||||||
dup = Dup,
|
dup = Dup,
|
||||||
topic = Topic,
|
topic = Topic,
|
||||||
payload = Payload,
|
payload = Payload,
|
||||||
timestamp = emqttd_time:now_to_secs()};
|
timestamp = os:timestamp()};
|
||||||
|
|
||||||
from_packet(#mqtt_packet_connect{will_flag = false}) ->
|
from_packet(#mqtt_packet_connect{will_flag = false}) ->
|
||||||
undefined;
|
undefined;
|
||||||
|
@ -78,7 +81,7 @@ from_packet(#mqtt_packet_connect{client_id = ClientId,
|
||||||
qos = Qos,
|
qos = Qos,
|
||||||
dup = false,
|
dup = false,
|
||||||
payload = Msg,
|
payload = Msg,
|
||||||
timestamp = emqttd_time:now_to_secs()}.
|
timestamp = os:timestamp()}.
|
||||||
|
|
||||||
from_packet(ClientId, Packet) ->
|
from_packet(ClientId, Packet) ->
|
||||||
Msg = from_packet(Packet),
|
Msg = from_packet(Packet),
|
||||||
|
|
Loading…
Reference in New Issue