IBR-DTN
1.0.0
|
#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 const 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 263 of file Clock.cpp.
References dtn::data::SDNV< E >::get(), gettimeofday(), and TIMEVAL_CONVERSION.
Referenced by getTime(), and dtn::data::DTNTime::set().
|
static |
Return the time of expiration of the given bundle
Definition at line 91 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 175 of file Clock.cpp.
Referenced by dtn::routing::DeliveryPredictabilityMap::age(), dtn::security::KeyExchangeSession::KeyExchangeSession(), dtn::net::DiscoveryAgent::onBeaconReceived(), dtn::routing::ProphetRoutingExtension::ProphetRoutingExtension(), dtn::net::DiscoveryAgent::raiseEvent(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::routing::StaticRoutingExtension::raiseEvent(), dtn::routing::ProphetRoutingExtension::raiseEvent(), dtn::security::KeyExchanger::raiseEvent(), dtn::routing::DeliveryPredictabilityMap::restore(), dtn::routing::DeliveryPredictabilityMap::store(), dtn::core::WallClock::timeout(), and dtn::security::KeyExchangeSession::touch().
|
static |
Returns the local offset of the clock (prior set by setOffset)
Definition at line 182 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(), gettimeofday(), isExpired(), dtn::daemon::DTNTPWorker::onUpdateBeacon(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::data::PrimaryBlock::relabel(), setOffset(), settimeofday(), dtn::daemon::Configuration::Security::TLSRequired(), and dtn::core::BundleCore::validate().
|
static |
Return the current DTN timestamp
Definition at line 167 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::routing::DeliveryPredictabilityMap::restore(), dtn::routing::DeliveryPredictabilityMap::store(), 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 246 of file Clock.cpp.
References getRating(), and shouldModifyClock().
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), getdtntimeofday(), setModifyClock(), setOffset(), settimeofday(), and dtn::daemon::DTNTPWorker::TimeSyncMessage::TimeSyncMessage().
|
static |
Return the seconds since the last start-up
Definition at line 284 of file Clock.cpp.
Referenced by dtn::daemon::NativeDaemon::getStats().
|
static |
Check if a timestamp is expired
Definition at line 155 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 130 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 147 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.
References gettimeofday(), and settimeofday().
Referenced by dtn::daemon::Configuration::TimeSync::load().
|
static |
set the local offset of the clock
tv |
Definition at line 187 of file Clock.cpp.
References getRating(), gettimeofday(), settimeofday(), shouldModifyClock(), and toDouble().
|
static |
Set the rating returned by Clock::getRating()
Definition at line 64 of file Clock.cpp.
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 213 of file Clock.cpp.
References getRating(), gettimeofday(), shouldModifyClock(), and toDouble().
Referenced by setModifyClock(), and 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 gettimeofday(), setOffset(), and settimeofday().
|
static |
Converts a timeval to a double value
Definition at line 280 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().