time: adapt to the new API time structrue
diff --git a/src/sync-full-state.cc b/src/sync-full-state.cc
index eb9ca4c..7000606 100644
--- a/src/sync-full-state.cc
+++ b/src/sync-full-state.cc
@@ -45,10 +45,10 @@
{
}
-ndn::time::Duration
+ndn::time::system_clock::Duration
FullState::getTimeFromLastUpdate () const
{
- return ndn::time::now() - m_lastUpdated;
+ return ndn::time::system_clock::now() - m_lastUpdated;
}
DigestConstPtr
@@ -81,7 +81,7 @@
boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
FullState::update (NameInfoConstPtr info, const SeqNo &seq)
{
- m_lastUpdated = ndn::time::now();
+ m_lastUpdated = ndn::time::system_clock::now();
m_digest.reset ();
@@ -109,7 +109,7 @@
bool
FullState::remove (NameInfoConstPtr info)
{
- m_lastUpdated = ndn::time::now();
+ m_lastUpdated = ndn::time::system_clock::now();
m_digest.reset ();
diff --git a/src/sync-full-state.h b/src/sync-full-state.h
index 28e0078..028c41e 100644
--- a/src/sync-full-state.h
+++ b/src/sync-full-state.h
@@ -51,7 +51,7 @@
*
* This value can be used to randomize reconciliation waiting time in SyncApp
*/
- ndn::time::Duration
+ ndn::time::system_clock::Duration
getTimeFromLastUpdate () const;
/**
@@ -70,7 +70,7 @@
remove (NameInfoConstPtr info);
private:
- ndn::time::Point m_lastUpdated; ///< @brief Time when state was updated last time
+ ndn::time::system_clock::TimePoint m_lastUpdated; ///< @brief Time when state was updated last time
DigestPtr m_digest;
};
diff --git a/src/sync-interest-container.h b/src/sync-interest-container.h
index 742f053..f674d05 100644
--- a/src/sync-interest-container.h
+++ b/src/sync-interest-container.h
@@ -47,14 +47,14 @@
Interest (DigestConstPtr digest, const std::string &name, bool unknown=false)
: m_digest (digest)
, m_name (name)
- , m_time (ndn::time::now())
+ , m_time (ndn::time::system_clock::now())
, m_unknown (unknown)
{
}
DigestConstPtr m_digest;
std::string m_name;
- ndn::time::Point m_time;
+ ndn::time::system_clock::TimePoint m_time;
bool m_unknown;
};
@@ -87,7 +87,7 @@
mi::ordered_non_unique<
mi::tag<timed>,
- BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::Point, m_time)
+ BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::system_clock::TimePoint, m_time)
>
>
>
diff --git a/src/sync-interest-table.cc b/src/sync-interest-table.cc
index a378950..415b641 100644
--- a/src/sync-interest-table.cc
+++ b/src/sync-interest-table.cc
@@ -29,7 +29,7 @@
namespace Sync
{
-SyncInterestTable::SyncInterestTable (boost::asio::io_service& io, ndn::time::Duration lifetime)
+SyncInterestTable::SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime)
: m_entryLifetime (lifetime)
, m_scheduler(io)
{
@@ -103,7 +103,7 @@
void SyncInterestTable::expireInterests ()
{
uint32_t count = 0;
- ndn::time::Point expireTime = ndn::time::now() - m_entryLifetime;
+ ndn::time::system_clock::TimePoint expireTime = ndn::time::system_clock::now() - m_entryLifetime;
while (m_table.size () > 0)
{
diff --git a/src/sync-interest-table.h b/src/sync-interest-table.h
index 9b7c46b..4810c41 100644
--- a/src/sync-interest-table.h
+++ b/src/sync-interest-table.h
@@ -42,7 +42,7 @@
class SyncInterestTable
{
public:
- SyncInterestTable (boost::asio::io_service& io, ndn::time::Duration lifetime);
+ SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime);
~SyncInterestTable ();
/**
@@ -81,7 +81,7 @@
expireInterests ();
private:
- ndn::time::Duration m_entryLifetime;
+ ndn::time::system_clock::Duration m_entryLifetime;
InterestContainer m_table;
ndn::Scheduler m_scheduler;
diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 5d20143..617830b 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -49,7 +49,7 @@
(time::seconds(sec) + time::milliseconds(GET_RANDOM (m_reexpressionJitter)))
#define TIME_MILLISECONDS_WITH_JITTER(ms) \
- (time::seconds(ms) + time::milliseconds(GET_RANDOM (m_reexpressionJitter)))
+ (time::milliseconds(ms) + time::milliseconds(GET_RANDOM (m_reexpressionJitter)))
namespace Sync {
@@ -57,6 +57,9 @@
int SyncLogic::m_instanceCounter = 0;
+const int SyncLogic::m_syncResponseFreshness = 1000; // MUST BE dividable by 1000!!!
+const int SyncLogic::m_syncInterestReexpress = 4; // seconds
+
SyncLogic::SyncLogic (const Name& syncPrefix,
const IdentityCertificate& myCertificate,
shared_ptr<Validator> validator,
@@ -430,7 +433,7 @@
// satisfyPendingSyncInterests (diffLog); // if there are interests in PIT, there is a point to satisfy them using new state
// if state has changed, then it is safe to express a new interest
- time::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
+ time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
// cout << "------------ reexpress interest after: " << after << endl;
EventId eventId = m_scheduler.scheduleEvent (after,
bind (&SyncLogic::sendSyncInterest, this));
@@ -602,7 +605,7 @@
Name interestName = m_syncPrefix;
interestName.append("recovery").append(os.str());
- time::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
+ time::system_clock::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
m_recoveryRetransmissionInterval <<= 1;
@@ -640,7 +643,7 @@
Data syncData(name);
syncData.setContent(reinterpret_cast<const uint8_t*>(wireData), size);
- syncData.setFreshnessPeriod(m_syncResponseFreshness);
+ syncData.setFreshnessPeriod(time::milliseconds(m_syncResponseFreshness));
m_keyChain.sign(syncData, m_myCertificate.getName());
@@ -658,7 +661,7 @@
{
_LOG_DEBUG_ID ("Satisfied our own Interest. Re-expressing (hopefully with a new digest)");
- time::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
+ time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
// cout << "------------ reexpress interest after: " << after << endl;
EventId eventId = m_scheduler.scheduleEvent (after,
bind (&SyncLogic::sendSyncInterest, this));
diff --git a/src/sync-logic.h b/src/sync-logic.h
index ec8fc29..98ab0aa 100644
--- a/src/sync-logic.h
+++ b/src/sync-logic.h
@@ -193,8 +193,8 @@
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_reexpressionJitter;
static const int m_unknownDigestStoreTime = 10; // seconds
- static const int m_syncResponseFreshness = 1000; // MUST BE dividable by 1000!!!
- static const int m_syncInterestReexpress = 4; // seconds
+ static const int m_syncResponseFreshness; // MUST BE dividable by 1000!!!
+ static const int m_syncInterestReexpress; // seconds
static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds
uint32_t m_recoveryRetransmissionInterval; // milliseconds
diff --git a/src/sync-socket.cc b/src/sync-socket.cc
index ca015de..9c31f79 100644
--- a/src/sync-socket.cc
+++ b/src/sync-socket.cc
@@ -92,7 +92,7 @@
{
shared_ptr<Data> data = make_shared<Data>();
data->setContent(reinterpret_cast<const uint8_t*>(buf), len);
- data->setFreshnessPeriod(1000*freshness);
+ data->setFreshnessPeriod(time::milliseconds(1000*freshness));
m_ioService->post(bind(&SyncSocket::publishDataInternal, this,
data, isCert));
diff --git a/src/sync-validator.cc b/src/sync-validator.cc
index 2d86dbe..e1d40d8 100644
--- a/src/sync-validator.cc
+++ b/src/sync-validator.cc
@@ -130,7 +130,7 @@
Name interestName = m_prefix;
interestName.append("CHRONOS-INTRO-CERT").append(keyLocatorName.wireEncode());
Interest interest(interestName);
- interest.setInterestLifetime(500);
+ interest.setInterestLifetime(time::milliseconds(500));
OnDataValidated onKeyValidated = bind(&SyncValidator::onCertificateValidated, this,
_1, data.shared_from_this(), onValidated, onValidationFailed);