all: Update code to compile with latest time-related changes in ndn-cpp-dev library
Change-Id: I7e859989c833001f49b286d4a9917f4dc740b4a4
diff --git a/daemon/mgmt/segment-publisher.cpp b/daemon/mgmt/segment-publisher.cpp
index bd7d971..fefe30e 100644
--- a/daemon/mgmt/segment-publisher.cpp
+++ b/daemon/mgmt/segment-publisher.cpp
@@ -33,7 +33,7 @@
SegmentPublisher::publish()
{
Name segmentPrefix(m_prefix);
- segmentPrefix.appendSegment(ndn::ndn_getNowMilliseconds());
+ segmentPrefix.appendSegment(time::toUnixTimestamp(time::system_clock::now()).count());
static const size_t MAX_SEGMENT_SIZE = MAX_NDN_PACKET_SIZE >> 1;
diff --git a/daemon/mgmt/status-server.cpp b/daemon/mgmt/status-server.cpp
index 9635488..61a67b1 100644
--- a/daemon/mgmt/status-server.cpp
+++ b/daemon/mgmt/status-server.cpp
@@ -11,31 +11,12 @@
namespace nfd {
const Name StatusServer::DATASET_PREFIX = "ndn:/localhost/nfd/status";
-const ndn::Milliseconds StatusServer::RESPONSE_FRESHNESS = 5000;
-
-static inline ndn::nfd::Status::Timestamp
-now()
-{
- // make sure boost::chrono::system_clock's epoch is UNIX epoch
- BOOST_ASSERT(static_cast<std::time_t>(0) == boost::chrono::system_clock::to_time_t(
- boost::chrono::system_clock::time_point(
- boost::chrono::duration_cast<boost::chrono::system_clock::duration>(
- ndn::nfd::Status::Timestamp::duration::zero()
- )
- )
- ));
-
- return ndn::nfd::Status::Timestamp(
- boost::chrono::duration_cast<ndn::nfd::Status::Timestamp::duration>(
- boost::chrono::system_clock::now().time_since_epoch()
- )
- );
-}
+const time::milliseconds StatusServer::RESPONSE_FRESHNESS = time::milliseconds(5000);
StatusServer::StatusServer(shared_ptr<AppFace> face, Forwarder& forwarder)
: m_face(face)
, m_forwarder(forwarder)
- , m_startTimestamp(now())
+ , m_startTimestamp(time::system_clock::now())
{
m_face->setInterestFilter(DATASET_PREFIX, bind(&StatusServer::onInterest, this, _2));
}
@@ -44,9 +25,10 @@
StatusServer::onInterest(const Interest& interest) const
{
Name name(DATASET_PREFIX);
- // TODO use NumberComponent
- name.append(ndn::Name::Component::fromNumberWithMarker(ndn::ndn_getNowMilliseconds(), 0x00));
- name.append(ndn::Name::Component::fromNumberWithMarker(0, 0x00));
+ /// \todo use NumberComponent
+ name.append(Name::Component::fromNumberWithMarker(
+ time::toUnixTimestamp(time::system_clock::now()).count(), 0x00));
+ name.append(Name::Component::fromNumberWithMarker(0, 0x00));
shared_ptr<Data> data = make_shared<Data>(name);
data->setFreshnessPeriod(RESPONSE_FRESHNESS);
@@ -67,7 +49,7 @@
status->setNfdVersion(NFD_VERSION);
status->setStartTimestamp(m_startTimestamp);
- status->setCurrentTimestamp(now());
+ status->setCurrentTimestamp(time::system_clock::now());
status->setNNameTreeEntries(m_forwarder.getNameTree().size());
status->setNFibEntries(m_forwarder.getFib().size());
diff --git a/daemon/mgmt/status-server.hpp b/daemon/mgmt/status-server.hpp
index 94c8e82..c9a14f5 100644
--- a/daemon/mgmt/status-server.hpp
+++ b/daemon/mgmt/status-server.hpp
@@ -28,11 +28,11 @@
private:
static const Name DATASET_PREFIX;
- static const ndn::Milliseconds RESPONSE_FRESHNESS;
+ static const time::milliseconds RESPONSE_FRESHNESS;
shared_ptr<AppFace> m_face;
Forwarder& m_forwarder;
- ndn::nfd::Status::Timestamp m_startTimestamp;
+ time::system_clock::TimePoint m_startTimestamp;
};
} // namespace nfd