mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 02:30:11 +00:00
Include timestamp TLV (#564)
* Include timestamp TLV * Keep one copy of timestamp
This commit is contained in:
@@ -896,12 +896,12 @@ ThreadError Mle::AppendActiveTimestamp(Message &aMessage)
|
||||
{
|
||||
ThreadError error;
|
||||
ActiveTimestampTlv timestampTlv;
|
||||
const MeshCoP::Timestamp ×tamp(mNetif.GetActiveDataset().GetNetwork().GetTimestamp());
|
||||
const MeshCoP::Timestamp *timestamp(mNetif.GetActiveDataset().GetNetwork().GetTimestamp());
|
||||
|
||||
VerifyOrExit(timestamp.GetSeconds() != 0, error = kThreadError_None);
|
||||
VerifyOrExit(timestamp && timestamp->GetSeconds() != 0, error = kThreadError_None);
|
||||
|
||||
timestampTlv.Init();
|
||||
*static_cast<MeshCoP::Timestamp *>(×tampTlv) = timestamp;
|
||||
*static_cast<MeshCoP::Timestamp *>(×tampTlv) = *timestamp;
|
||||
error = aMessage.Append(×tampTlv, sizeof(timestampTlv));
|
||||
|
||||
exit:
|
||||
@@ -912,12 +912,12 @@ ThreadError Mle::AppendPendingTimestamp(Message &aMessage)
|
||||
{
|
||||
ThreadError error;
|
||||
PendingTimestampTlv timestampTlv;
|
||||
const MeshCoP::Timestamp ×tamp(mNetif.GetPendingDataset().GetNetwork().GetTimestamp());
|
||||
const MeshCoP::Timestamp *timestamp(mNetif.GetPendingDataset().GetNetwork().GetTimestamp());
|
||||
|
||||
VerifyOrExit(timestamp.GetSeconds() != 0, error = kThreadError_None);
|
||||
VerifyOrExit(timestamp && timestamp->GetSeconds() != 0, error = kThreadError_None);
|
||||
|
||||
timestampTlv.Init();
|
||||
*static_cast<MeshCoP::Timestamp *>(×tampTlv) = timestamp;
|
||||
*static_cast<MeshCoP::Timestamp *>(×tampTlv) = *timestamp;
|
||||
error = aMessage.Append(×tampTlv, sizeof(timestampTlv));
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user