IBR-DTNSuite
0.12
|
#include <Clock.h>
Static Public Member Functions | |
static dtn::data::Timestamp | getMonotonicTimestamp () |
static dtn::data::Timestamp | getTime () |
static bool | isExpired (const dtn::data::Timestamp ×tamp, const dtn::data::Number &lifetime) |
static bool | isExpired (const dtn::data::Bundle &b) |
static bool | isExpired (const dtn::data::MetaBundle &m) |
static dtn::data::Timestamp | getExpireTime (const dtn::data::Bundle &b) |
static dtn::data::Timestamp | getExpireTime (const dtn::data::Timestamp ×tamp, const dtn::data::Number &lifetime) __attribute__((deprecated)) |
static dtn::data::Timestamp | getExpireTime (const dtn::data::Number &lifetime) |
static void | settimeofday (struct timeval *tv) |
static void | gettimeofday (struct timeval *tv) |
static void | getdtntimeofday (struct timeval *tv) |
static void | setOffset (const struct timeval &tv) |
static struct timeval & | getOffset () |
static double | getRating () |
static void | setRating (double val) |
static bool | shouldModifyClock () |
static void | setModifyClock (bool val) |
static double | toDouble (const timeval &val) |
static dtn::data::Timestamp | getUptime () |
Static Public Attributes | |
static const dtn::data::Timestamp | TIMEVAL_CONVERSION = 946684800 |
|
static |
Get the time of the day like ::gettimeofday(), but correct the value by the known clock offset and the bundle protocol time offset.
tv |
Definition at line 249 of file Clock.cpp.
References dtn::data::SDNV< E >::get(), gettimeofday(), shouldModifyClock(), and TIMEVAL_CONVERSION.
Referenced by getTime(), and dtn::data::DTNTime::set().
|
static |
Return the time of expiration of the given bundle
Definition at line 82 of file Clock.cpp.
References dtn::data::Bundle::find(), dtn::data::AgeBlock::getSeconds(), getTime(), dtn::data::PrimaryBlock::lifetime, and dtn::data::BundleID::timestamp.
Referenced by dtn::utils::Utils::encapsule(), dtn::data::DefaultDeserializer::operator>>(), dtn::core::FragmentManager::setOffset(), dtn::storage::SQLiteDatabase::store(), and dtn::routing::NeighborDatabase::NeighborEntry::update().
|
static |
|
static |
|
static |
Return a monotonic timestamp, valid within the current process only
Definition at line 166 of file Clock.cpp.
References ibrcommon::MonotonicClock::getSeconds().
Referenced by dtn::routing::DeliveryPredictabilityMap::age(), getUptime(), dtn::net::DiscoveryAgent::onBeaconReceived(), dtn::routing::ProphetRoutingExtension::ProphetRoutingExtension(), dtn::net::DiscoveryAgent::raiseEvent(), dtn::routing::StaticRoutingExtension::raiseEvent(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::routing::ProphetRoutingExtension::raiseEvent(), and dtn::core::WallClock::timeout().
|
static |
Returns the local offset of the clock (prior set by setOffset)
Definition at line 171 of file Clock.cpp.
Referenced by dtn::daemon::NativeDaemon::getStats().
|
static |
Defines an estimation about the precision of the local time. If the clock is definitely wrong the value is zero and one when we have a perfect time sync. Everything between one and zero gives an abstract knowledge about the rating of the local clock.
Definition at line 59 of file Clock.cpp.
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), dtn::daemon::NativeDaemon::getStats(), isExpired(), dtn::daemon::DTNTPWorker::onUpdateBeacon(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::data::PrimaryBlock::relabel(), dtn::daemon::Configuration::Security::TLSRequired(), and dtn::core::BundleCore::validate().
|
static |
Return the current DTN timestamp
Definition at line 158 of file Clock.cpp.
References getdtntimeofday().
Referenced by dtn::net::ConnectionManager::add(), dtn::net::ConnectionManager::componentUp(), dtn::daemon::DTNTPWorker::DTNTPWorker(), dtn::core::Node::expire(), getExpireTime(), dtn::daemon::NativeDaemon::getStats(), isExpired(), dtn::daemon::DTNTPWorker::onUpdateBeacon(), dtn::data::PrimaryBlock::relabel(), dtn::routing::NeighborDatabase::NeighborEntry::reset(), dtn::core::WallClock::timeout(), dtn::routing::NeighborDatabase::NeighborEntry::touch(), dtn::api::Registration::underflow(), and dtn::core::BundleCore::validate().
|
static |
Get the time of the day like ::gettimeofday(), but correct the value by the known clock offset.
tv |
Definition at line 230 of file Clock.cpp.
References shouldModifyClock().
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), getdtntimeofday(), setOffset(), settimeofday(), and dtn::daemon::DTNTPWorker::TimeSyncMessage::TimeSyncMessage().
|
static |
Return the seconds since the last start-up
Definition at line 283 of file Clock.cpp.
References getMonotonicTimestamp().
Referenced by dtn::daemon::NativeDaemon::getStats().
|
static |
Check if a timestamp is expired
Definition at line 146 of file Clock.cpp.
References getRating(), and getTime().
Referenced by dtn::storage::MemoryBundleStorage::get(), dtn::storage::SimpleBundleStorage::get(), isExpired(), and dtn::core::BundleCore::validate().
|
static |
Check if a bundle is expired
Definition at line 121 of file Clock.cpp.
References dtn::data::Bundle::find(), dtn::data::AgeBlock::getSeconds(), isExpired(), dtn::data::PrimaryBlock::lifetime, and dtn::data::BundleID::timestamp.
|
static |
Check if a meta bundle is expired
Definition at line 138 of file Clock.cpp.
References dtn::data::MetaBundle::expiretime, and getTime().
|
static |
Set the clock modification parameter returned by Clock::shouldModifyClock()
Definition at line 77 of file Clock.cpp.
Referenced by dtn::daemon::Configuration::TimeSync::load().
|
static |
set the local offset of the clock
tv |
Definition at line 176 of file Clock.cpp.
References gettimeofday(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, settimeofday(), shouldModifyClock(), and toDouble().
|
static |
Set the rating returned by Clock::getRating()
Definition at line 64 of file Clock.cpp.
References IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.
Referenced by dtn::daemon::DTNTPWorker::DTNTPWorker(), and dtn::daemon::DTNTPWorker::raiseEvent().
|
static |
Tells the internal clock the offset to the common network time.
Definition at line 205 of file Clock.cpp.
References gettimeofday(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, shouldModifyClock(), and toDouble().
Referenced by setOffset().
|
static |
if set to true, the function settimeofday() and setOffset() will modify the clock of the host instead of storing the local offset.
Definition at line 72 of file Clock.cpp.
Referenced by getdtntimeofday(), gettimeofday(), setOffset(), and settimeofday().
|
static |
Converts a timeval to a double value
Definition at line 279 of file Clock.cpp.
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), dtn::core::TimeAdjustmentEvent::getMessage(), dtn::daemon::NativeDaemon::getStats(), setOffset(), and settimeofday().
|
static |
The number of seconds between 1/1/1970 and 1/1/2000.
Definition at line 154 of file Clock.h.
Referenced by getdtntimeofday().