IBR-DTNSuite
0.10
|
#include <Clock.h>
Static Public Member Functions | |
static dtn::data::Timestamp | getUnixTimestamp () |
static dtn::data::Timestamp | getTime () |
static bool | isExpired (const dtn::data::Bundle &b) |
static bool | isExpired (const dtn::data::Timestamp ×tamp, const dtn::data::Number &lifetime=0) __attribute__((deprecated)) |
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 dtn::data::Number | getLifetime (const dtn::data::BundleID &id, const dtn::data::Timestamp &expiretime) |
static void | settimeofday (struct timeval *tv) |
static void | gettimeofday (struct timeval *tv) |
static void | setOffset (const struct timeval &tv) |
static struct timeval & | getOffset () |
static bool | isBad () |
static void | setBad (bool val) |
static int | getTimezone () |
static void | setTimezone (int val) |
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 |
Return the time of expiration of the given bundle
Definition at line 100 of file Clock.cpp.
References dtn::data::Bundle::find(), dtn::data::AgeBlock::getSeconds(), getTime(), isBad(), dtn::data::PrimaryBlock::lifetime, and dtn::data::PrimaryBlock::timestamp.
Referenced by dtn::utils::Utils::encapsule(), dtn::data::MetaBundle::MetaBundle(), dtn::data::DefaultDeserializer::operator>>(), dtn::core::FragmentManager::setOffset(), and dtn::routing::NeighborDatabase::NeighborEntry::update().
|
static |
|
static |
|
static |
Returns the calculated lifetime in seconds based on the BundleID and the expiretime
Definition at line 128 of file Clock.cpp.
Referenced by dtn::routing::operator>>().
|
staticread |
Returns the local offset of the clock (prior set by setOffset)
Definition at line 211 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 77 of file Clock.cpp.
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), dtn::daemon::NativeDaemon::getStats(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::daemon::Configuration::Security::TLSRequired(), dtn::daemon::DTNTPWorker::update(), and dtn::core::BundleCore::validate().
|
static |
Return the current DTN timestamp adjusted by the configured timezone offset
Definition at line 183 of file Clock.cpp.
References gettimeofday(), getTimezone(), and TIMEVAL_CONVERSION.
Referenced by dtn::net::ConnectionManager::componentUp(), dtn::daemon::DTNTPWorker::DTNTPWorker(), dtn::core::Node::expire(), getExpireTime(), dtn::daemon::NativeDaemon::getStats(), dtn::net::DiscoveryAgent::received(), dtn::data::PrimaryBlock::relabel(), dtn::routing::NeighborDatabase::NeighborEntry::reset(), dtn::core::WallClock::timeout(), dtn::routing::NeighborDatabase::NeighborEntry::touch(), dtn::api::Registration::underflow(), dtn::daemon::DTNTPWorker::update(), 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 265 of file Clock.cpp.
References shouldModifyClock().
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), getTime(), getUnixTimestamp(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::data::DTNTime::set(), setOffset(), settimeofday(), and dtn::daemon::DTNTPWorker::TimeSyncMessage::TimeSyncMessage().
|
static |
Specify a timezone offset in hours
Definition at line 67 of file Clock.cpp.
Referenced by getTime(), and getUnixTimestamp().
|
static |
Return the current unix timestamp adjusted by the configured timezone offset
Definition at line 200 of file Clock.cpp.
References gettimeofday(), and getTimezone().
Referenced by dtn::routing::DeliveryPredictabilityMap::age(), getUptime(), dtn::routing::StaticRoutingExtension::notify(), dtn::routing::ProphetRoutingExtension::ProphetRoutingExtension(), and dtn::core::WallClock::timeout().
|
static |
Return the seconds since the last start-up
Definition at line 287 of file Clock.cpp.
References getUnixTimestamp().
Referenced by dtn::daemon::NativeDaemon::getStats().
|
static |
If set to true, all time based functions assume a bad clock and try to use other mechanisms to detect expiration.
Definition at line 57 of file Clock.cpp.
Referenced by getExpireTime(), dtn::daemon::Configuration::params(), and dtn::data::PrimaryBlock::relabel().
|
static |
Check if a bundle is expired
Definition at line 150 of file Clock.cpp.
References dtn::data::Bundle::find(), dtn::data::AgeBlock::getSeconds(), dtn::data::PrimaryBlock::lifetime, and dtn::data::PrimaryBlock::timestamp.
Referenced by dtn::storage::MemoryBundleStorage::get(), dtn::storage::SimpleBundleStorage::get(), dtn::data::PrimaryBlock::isExpired(), and dtn::core::BundleCore::validate().
|
static |
|
static |
Set the bad state of the clock returned by Clock::isBad()
Definition at line 62 of file Clock.cpp.
Referenced by dtn::daemon::Configuration::params().
|
static |
Set the clock modification parameter returned by Clock::shouldModifyClock()
Definition at line 95 of file Clock.cpp.
Referenced by dtn::daemon::Configuration::TimeSync::load().
|
static |
set the local offset of the clock
tv |
Definition at line 216 of file Clock.cpp.
References gettimeofday(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, settimeofday(), shouldModifyClock(), and toDouble().
Referenced by dtn::core::BundleCore::raiseEvent().
|
static |
Set the rating returned by Clock::getRating()
Definition at line 82 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 242 of file Clock.cpp.
References gettimeofday(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, shouldModifyClock(), and toDouble().
Referenced by setOffset().
|
static |
Set a timezone offset in hours
Definition at line 72 of file Clock.cpp.
Referenced by dtn::core::BundleCore::onConfigurationChanged().
|
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 90 of file Clock.cpp.
Referenced by gettimeofday(), setOffset(), and settimeofday().
|
static |
Converts a timeval to a double value
Definition at line 283 of file Clock.cpp.
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), dtn::core::TimeAdjustmentEvent::getMessage(), dtn::daemon::NativeDaemon::getStats(), dtn::daemon::DTNTPWorker::raiseEvent(), setOffset(), and settimeofday().
|
static |