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 | |
typedef CustomClock< system_clock > | CustomSystemClock |
typedef CustomClock< steady_clock > | CustomSteadyClock |
typedef UnitTestClock< system_clock > | UnitTestSystemClock |
typedef UnitTestClock< steady_clock > | UnitTestSteadyClock |
typedef boost::chrono::steady_clock | base_steady_clock |
typedef duration< boost::int_least32_t, boost::ratio< 86400 > > | days |
Functions | |
void | setCustomClocks (shared_ptr< CustomSteadyClock > steadyClock=nullptr, shared_ptr< CustomSystemClock > systemClock=nullptr) |
Set custom system and steady clocks. More... | |
const std::chrono::microseconds | SLEEP_AFTER_TIME_CHANGE (2) |
const system_clock::TimePoint & | getUnixEpoch () |
Get system_clock::TimePoint representing UNIX time epoch (00:00:00 on Jan 1, 1970) More... | |
milliseconds | toUnixTimestamp (const system_clock::TimePoint &point) |
Convert system_clock::TimePoint to UNIX timestamp. More... | |
system_clock::TimePoint | fromUnixTimestamp (const milliseconds &duration) |
Convert UNIX timestamp to system_clock::TimePoint. More... | |
std::string | toIsoString (const system_clock::TimePoint &timePoint) |
Convert to the ISO string representation of the time (YYYYMMDDTHHMMSS,fffffffff) More... | |
system_clock::TimePoint | fromIsoString (const std::string &isoString) |
Convert from the ISO string (YYYYMMDDTHHMMSS,fffffffff) representation to the internal time format. More... | |
std::string | toString (const system_clock::TimePoint &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::TimePoint | fromString (const std::string &formattedTimePoint, 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... | |
Variables | |
static shared_ptr< CustomSystemClock > | g_systemClock |
static shared_ptr< CustomSteadyClock > | g_steadyClock |
Definition at line 54 of file time-custom-clock.hpp.
Definition at line 55 of file time-custom-clock.hpp.
Definition at line 108 of file time-unit-test-clock.hpp.
Definition at line 109 of file time-unit-test-clock.hpp.
typedef boost::chrono::steady_clock ndn::time::base_steady_clock |
typedef duration<boost::int_least32_t, boost::ratio<86400> > ndn::time::days |
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 35 of file time.cpp.
Referenced by ns3::ndn::StackHelper::setCustomNdnCxxClocks().
const std::chrono::microseconds ndn::time::SLEEP_AFTER_TIME_CHANGE | ( | 2 | ) |
const system_clock::TimePoint & ndn::time::getUnixEpoch | ( | ) |
Get system_clock::TimePoint representing UNIX time epoch (00:00:00 on Jan 1, 1970)
Definition at line 111 of file time.cpp.
References ndn::time::system_clock::from_time_t().
Referenced by ndn::name::Component::fromTimestamp(), fromUnixTimestamp(), toIsoString(), toString(), ndn::name::Component::toTimestamp(), and toUnixTimestamp().
milliseconds ndn::time::toUnixTimestamp | ( | const system_clock::TimePoint & | point | ) |
Convert system_clock::TimePoint to UNIX timestamp.
Definition at line 118 of file time.cpp.
References getUnixEpoch().
Referenced by ndn::SecPublicInfoSqlite3::addCertificate(), ndn::Name::appendVersion(), ndn::SecPublicInfo::getNewKeyName(), ndn::security::KeyChain::importIdentity(), ndn::security::KeyChain::signWithSha256(), and ndn::nfd::ForwarderStatus::wireEncode().
system_clock::TimePoint ndn::time::fromUnixTimestamp | ( | const milliseconds & | duration | ) |
Convert UNIX timestamp to system_clock::TimePoint.
Definition at line 124 of file time.cpp.
References getUnixEpoch().
Referenced by ndn::ValidatorConfig::checkPolicy(), ndn::CommandInterestValidator::checkPolicy(), and ndn::nfd::ForwarderStatus::wireDecode().
std::string ndn::time::toIsoString | ( | const system_clock::TimePoint & | timePoint | ) |
Convert to the ISO string representation of the time (YYYYMMDDTHHMMSS,fffffffff)
If timePoint contains doesn't contain fractional seconds the output format is YYYYMMDDTHHMMSS
Examples:
Definition at line 130 of file time.cpp.
References getUnixEpoch(), and ndn::time::system_clock::to_time_t().
Referenced by ndn::DEREncodeGeneralTime(), ndn::security::operator<<(), ndn::Certificate::printCertificate(), and ndn::security::ValidityPeriod::wireEncode().
system_clock::TimePoint ndn::time::fromIsoString | ( | const std::string & | isoString | ) |
Convert from the ISO string (YYYYMMDDTHHMMSS,fffffffff) representation to the internal time format.
Examples of accepted ISO strings:
Definition at line 147 of file time.cpp.
References ndn::time::system_clock::from_time_t().
Referenced by ndn::BERDecodeTime(), and ndn::security::ValidityPeriod::wireDecode().
std::string ndn::time::toString | ( | const system_clock::TimePoint & | 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 162 of file time.cpp.
References getUnixEpoch(), and ndn::time::system_clock::to_time_t().
Referenced by nfd::Face::copyStatusTo(), and ndn::OID::setIntegerList().
system_clock::TimePoint ndn::time::fromString | ( | const std::string & | formattedTimePoint, |
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
formattedTimePoint | string representing time point |
format | input output format (default: Y-m-d H:M:S ) |
locale | input locale (default: "C" locale) |
Definition at line 182 of file time.cpp.
References ndn::time::system_clock::from_time_t().
|
static |
Definition at line 30 of file time.cpp.
Referenced by boost::chrono::clock_string< ndn::time::system_clock, CharT >::since().
|
static |
Definition at line 31 of file time.cpp.
Referenced by boost::chrono::clock_string< ndn::time::steady_clock, CharT >::since().