Classes | |
class | CustomClock |
Class implementing custom system or steady clock behavior. More... | |
class | steady_clock |
Steady clock. More... | |
class | system_clock |
System clock. More... | |
class | UnitTestClock |
Clock that can be used in unit tests for time-dependent tests independent of wall clock. More... | |
class | UnitTestClockTraits |
Traits for UnitTestClock, defining default behavior for different clocks. More... | |
class | UnitTestClockTraits< system_clock > |
Specialization of UnitTestClockTraits for system_clock. More... | |
Typedefs | |
using | CustomSystemClock = CustomClock< system_clock > |
using | CustomSteadyClock = CustomClock< steady_clock > |
using | UnitTestSystemClock = UnitTestClock< system_clock > |
using | UnitTestSteadyClock = UnitTestClock< steady_clock > |
typedef boost::chrono::steady_clock | base_steady_clock |
template<typename Rep , typename Period > | |
using | duration = boost::chrono::duration< Rep, Period > |
using | days = duration< int_fast32_t, boost::ratio< 86400 > > |
using | weeks = duration< int_fast32_t, boost::ratio< 604800 > > |
using | months = duration< int_fast32_t, boost::ratio< 2629746 > > |
using | years = duration< int_fast32_t, boost::ratio< 31556952 > > |
using | hours = boost::chrono::hours |
using | minutes = boost::chrono::minutes |
using | seconds = boost::chrono::seconds |
using | milliseconds = boost::chrono::milliseconds |
using | microseconds = boost::chrono::microseconds |
using | nanoseconds = boost::chrono::nanoseconds |
Functions | |
void | setCustomClocks (shared_ptr< CustomSteadyClock > steadyClock=nullptr, shared_ptr< CustomSystemClock > systemClock=nullptr) |
Set custom system and steady clocks. More... | |
const system_clock::time_point & | getUnixEpoch () |
Return a system_clock::time_point representing the UNIX time epoch, i.e., 00:00:00 UTC on 1 January 1970. More... | |
milliseconds | toUnixTimestamp (const system_clock::time_point &point) |
Convert system_clock::time_point to UNIX timestamp. More... | |
system_clock::time_point | fromUnixTimestamp (milliseconds duration) |
Convert UNIX timestamp to system_clock::time_point. More... | |
static boost::posix_time::ptime | convertToPosixTime (const system_clock::time_point &timePoint) |
std::string | toIsoString (const system_clock::time_point &timePoint) |
Convert to the ISO 8601 string representation, basic format (YYYYMMDDTHHMMSS,fffffffff ). More... | |
std::string | toIsoExtendedString (const system_clock::time_point &timePoint) |
Convert to the ISO 8601 string representation, extended format (YYYY-MM-DDTHH:MM:SS,fffffffff ). More... | |
static system_clock::time_point | convertToTimePoint (const boost::posix_time::ptime &ptime) |
system_clock::time_point | fromIsoString (const std::string &isoString) |
Convert from the ISO 8601 basic string format (YYYYMMDDTHHMMSS,fffffffff ) to the internal time format. More... | |
system_clock::time_point | fromIsoExtendedString (const std::string &isoString) |
Convert from the ISO 8601 extended string format (YYYY-MM-DDTHH:MM:SS,fffffffff ) to the internal time format. More... | |
std::string | toString (const system_clock::time_point &timePoint, const std::string &format="%Y-%m-%d %H:%M:%S", const std::locale &locale=std::locale("C")) |
Convert time point to string with specified format. More... | |
system_clock::time_point | fromString (const std::string &timePointStr, const std::string &format="%Y-%m-%d %H:%M:%S", const std::locale &locale=std::locale("C")) |
Convert from string of specified format into time point. More... | |
template<typename Rep , typename Period , typename = std::enable_if_t<std::numeric_limits<Rep>::is_signed>> | |
constexpr duration< Rep, Period > | abs (duration< Rep, Period > d) |
Variables | |
static shared_ptr< CustomSystemClock > | g_systemClock |
static shared_ptr< CustomSteadyClock > | g_steadyClock |
using ndn::time::CustomSystemClock = typedef CustomClock<system_clock> |
Definition at line 53 of file time-custom-clock.hpp.
using ndn::time::CustomSteadyClock = typedef CustomClock<steady_clock> |
Definition at line 54 of file time-custom-clock.hpp.
using ndn::time::UnitTestSystemClock = typedef UnitTestClock<system_clock> |
Definition at line 108 of file time-unit-test-clock.hpp.
using ndn::time::UnitTestSteadyClock = typedef UnitTestClock<steady_clock> |
Definition at line 109 of file time-unit-test-clock.hpp.
typedef boost::chrono::steady_clock ndn::time::base_steady_clock |
using ndn::time::duration = typedef boost::chrono::duration<Rep, Period> |
using ndn::time::days = typedef duration<int_fast32_t, boost::ratio<86400> > |
using ndn::time::weeks = typedef duration<int_fast32_t, boost::ratio<604800> > |
using ndn::time::months = typedef duration<int_fast32_t, boost::ratio<2629746> > |
using ndn::time::years = typedef duration<int_fast32_t, boost::ratio<31556952> > |
using ndn::time::hours = typedef boost::chrono::hours |
using ndn::time::minutes = typedef boost::chrono::minutes |
using ndn::time::seconds = typedef boost::chrono::seconds |
using ndn::time::milliseconds = typedef boost::chrono::milliseconds |
using ndn::time::microseconds = typedef boost::chrono::microseconds |
using ndn::time::nanoseconds = typedef boost::chrono::nanoseconds |
void ndn::time::setCustomClocks | ( | shared_ptr< CustomSteadyClock > | steadyClock = nullptr , |
shared_ptr< CustomSystemClock > | systemClock = nullptr |
||
) |
Set custom system and steady clocks.
When steadyClock
or systemClock
set to nullptr, the default implementation of the corresponding clock will be used
Definition at line 36 of file time.cpp.
References nonstd::optional_lite::std11::move().
Referenced by ns3::ndn::StackHelper::setCustomNdnCxxClocks().
const system_clock::time_point & ndn::time::getUnixEpoch | ( | ) |
Return a system_clock::time_point representing the UNIX time epoch, i.e., 00:00:00 UTC on 1 January 1970.
Definition at line 106 of file time.cpp.
Referenced by convertToPosixTime(), ndn::name::Component::fromTimestamp(), fromUnixTimestamp(), ndn::name::Component::toTimestamp(), and toUnixTimestamp().
milliseconds ndn::time::toUnixTimestamp | ( | const system_clock::time_point & | point | ) |
Convert system_clock::time_point to UNIX timestamp.
Definition at line 113 of file time.cpp.
References getUnixEpoch().
Referenced by ndn::Name::appendVersion(), ndn::security::InterestSigner::makeCommandInterest(), ndn::operator<<(), ndn::SignatureInfo::setTime(), ndn::PrefixAnnouncement::toData(), and ndn::nfd::ForwarderStatus::wireEncode().
system_clock::time_point ndn::time::fromUnixTimestamp | ( | milliseconds | duration | ) |
Convert UNIX timestamp to system_clock::time_point.
Definition at line 119 of file time.cpp.
References getUnixEpoch().
Referenced by ndn::security::v2::ValidationPolicyCommandInterest::checkPolicy(), ndn::SignatureInfo::getTime(), and ndn::nfd::ForwarderStatus::wireDecode().
|
static |
Definition at line 125 of file time.cpp.
References getUnixEpoch().
Referenced by toIsoExtendedString(), toIsoString(), and toString().
std::string ndn::time::toIsoString | ( | const system_clock::time_point & | timePoint | ) |
Convert to the ISO 8601 string representation, basic format (YYYYMMDDTHHMMSS,fffffffff
).
If timePoint
does not contain any fractional seconds, the output format is YYYYMMDDTHHMMSS
.
Examples:
Definition at line 143 of file time.cpp.
References convertToPosixTime().
Referenced by ndn::security::v2::CertificateCache::insert(), ndn::security::operator<<(), and ndn::security::ValidityPeriod::wireEncode().
std::string ndn::time::toIsoExtendedString | ( | const system_clock::time_point & | timePoint | ) |
Convert to the ISO 8601 string representation, extended format (YYYY-MM-DDTHH:MM:SS,fffffffff
).
Definition at line 149 of file time.cpp.
References convertToPosixTime().
Referenced by ndn::security::v2::operator<<().
|
static |
Definition at line 155 of file time.cpp.
Referenced by fromIsoExtendedString(), fromIsoString(), and fromString().
system_clock::time_point ndn::time::fromIsoString | ( | const std::string & | isoString | ) |
Convert from the ISO 8601 basic string format (YYYYMMDDTHHMMSS,fffffffff
) to the internal time format.
Examples of accepted strings:
Definition at line 168 of file time.cpp.
References convertToTimePoint().
Referenced by ndn::security::ValidityPeriod::wireDecode().
system_clock::time_point ndn::time::fromIsoExtendedString | ( | const std::string & | isoString | ) |
Convert from the ISO 8601 extended string format (YYYY-MM-DDTHH:MM:SS,fffffffff
) to the internal time format.
Definition at line 174 of file time.cpp.
References convertToTimePoint().
std::string ndn::time::toString | ( | const system_clock::time_point & | timePoint, |
const std::string & | format = "%Y-%m-%d %H:%M:%S" , |
||
const std::locale & | locale = std::locale("C") |
||
) |
Convert time point to string with specified format.
By default, Y-m-d H:M:S
is used, producing dates like 2014-04-10 22:51:00
timePoint | time point of system_clock |
format | desired output format (default: Y-m-d H:M:S ) |
locale | desired locale (default: "C" locale) |
Definition at line 180 of file time.cpp.
References convertToPosixTime().
system_clock::time_point ndn::time::fromString | ( | const std::string & | timePointStr, |
const std::string & | format = "%Y-%m-%d %H:%M:%S" , |
||
const std::locale & | locale = std::locale("C") |
||
) |
Convert from string of specified format into time point.
By default, Y-m-d H:M:S
is used, accepting dates like 2014-04-10 22:51:00
timePointStr | string representing time point |
format | input output format (default: Y-m-d H:M:S ) |
locale | input locale (default: "C" locale) |
Definition at line 195 of file time.cpp.
References convertToTimePoint().
constexpr duration<Rep, Period> ndn::time::abs | ( | duration< Rep, Period > | d | ) |
Definition at line 58 of file time.hpp.
Referenced by ndn::util::RttEstimator::addMeasurement(), ndn::security::v2::ValidationPolicySignedInterest::checkPolicy(), ndn::net::GenlFamilyResolver::GenlFamilyResolver(), ns3::AnnotatedTopologyReader::Read(), and ndn::net::updateInterfaceState().
|
static |
Definition at line 31 of file time.cpp.
Referenced by boost::chrono::clock_string< ndn::time::system_clock, CharT >::since().
|
static |
Definition at line 32 of file time.cpp.
Referenced by boost::chrono::clock_string< ndn::time::steady_clock, CharT >::since().