all: Refactoring work with time using boost::chrono
Now the library has two clocks: time::steady_clock and
time::system_clock, following (boost|std)::chrono. In addition to
standard now() method, the library contains several helpers to convert
to/from UnixTimestamp (microsecond resolution) and IsoString (optional
microsecond resolution). The IsoString conversions use
boost::posix_time routines, since boost::chrono supports extended IO
support only starting boost version 1.52 (Boost Chrono V2).
This commit breaks compatibility with previous API. All time-related
Data/Interest calls must explicitly use time units to specify
FreshnessPeriod/InterestLifetime.
Brief usage/conversion guide:
- creation of time units does not support double/float types. If
necessary to create time unit from double, ``ndn::duration<double>`` (for
seconds) needs to be used instead. In some cases, this would also
require ``ndn::duration_cast``, if the target is not ``ndn::nanoseconds``.
- ndn::getNow, ndn::ndn_getNowMilliseconds, ndn::time::now are all
removed in favor of the now() method in a specific clock:
* time::system_clock::now();
* time::steady_clock::now();
- When necessary to convert system_clock::TimePoint to unix timestamp,
``time::toUnixTimestamp`` can be used. This method return number of
milliseconds since UNIX epoch as ``ndn::time::milliseconds`` type.
Use count() method to obtain number as an integral value.
Change-Id: Icd688bc6766e008d60c3d2888173627874526e47
Refs: #1152
diff --git a/src/face.hpp b/src/face.hpp
index fcd9bd0..4cb4c67 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -17,6 +17,7 @@
#include "management/controller.hpp"
+#include "util/scheduler.hpp"
#include "detail/registered-prefix.hpp"
#include "detail/pending-interest.hpp"
@@ -192,7 +193,8 @@
* call this from an main event loop, you may want to catch and log/disregard all exceptions.
*/
void
- processEvents(Milliseconds timeout = 0, bool keepThread = false);
+ processEvents(const time::milliseconds& timeout = time::milliseconds::zero(),
+ bool keepThread = false);
void
shutdown();
@@ -241,9 +243,9 @@
private:
shared_ptr<boost::asio::io_service> m_ioService;
shared_ptr<boost::asio::io_service::work> m_ioServiceWork; // needed if thread needs to be preserved
- shared_ptr<boost::asio::deadline_timer> m_pitTimeoutCheckTimer;
+ shared_ptr<monotonic_deadline_timer> m_pitTimeoutCheckTimer;
bool m_pitTimeoutCheckTimerActive;
- shared_ptr<boost::asio::deadline_timer> m_processEventsTimeoutTimer;
+ shared_ptr<monotonic_deadline_timer> m_processEventsTimeoutTimer;
shared_ptr<Transport> m_transport;