IBR-DTNSuite
0.8
|
#include <Clock.h>
Static Public Member Functions | |
static size_t | getUnixTimestamp () |
static size_t | getTime () |
static bool | isExpired (const dtn::data::Bundle &b) |
static bool | isExpired (size_t timestamp, size_t lifetime=0) __attribute__((deprecated)) |
static size_t | getExpireTime (const dtn::data::Bundle &b) |
static size_t | getExpireTime (size_t timestamp, size_t lifetime) __attribute__((deprecated)) |
static size_t | getExpireTime (size_t lifetime) |
static void | settimeofday (struct timeval *tv) |
static void | gettimeofday (struct timeval *tv) |
static void | setOffset (struct timeval &tv) |
Static Public Attributes | |
static int | timezone = 0 |
static u_int32_t | TIMEVAL_CONVERSION = 946684800 |
static float | quality = 0 |
static bool | badclock = false |
static bool | modify_clock = false |
size_t dtn::utils::Clock::getExpireTime | ( | const dtn::data::Bundle & | b | ) | [static] |
Definition at line 39 of file Clock.cpp.
References dtn::data::PrimaryBlock::_lifetime, dtn::data::PrimaryBlock::_timestamp, badclock, dtn::data::Bundle::getBlock(), dtn::data::AgeBlock::getSeconds(), and getTime().
Referenced by dtn::utils::Utils::encapsule(), dtn::data::MetaBundle::MetaBundle(), dtn::data::DefaultDeserializer::operator>>(), dtn::core::FragmentManager::setOffset(), and dtn::routing::NeighborDatabase::NeighborEntry::update().
size_t dtn::utils::Clock::getExpireTime | ( | size_t | timestamp, |
size_t | lifetime | ||
) | [static] |
size_t dtn::utils::Clock::getExpireTime | ( | size_t | lifetime | ) | [static] |
size_t dtn::utils::Clock::getTime | ( | ) | [static] |
Definition at line 106 of file Clock.cpp.
References gettimeofday(), TIMEVAL_CONVERSION, and timezone.
Referenced by dtn::net::ConnectionManager::componentUp(), dtn::core::Node::expire(), getExpireTime(), dtn::net::DiscoveryAgent::received(), dtn::data::PrimaryBlock::relabel(), dtn::routing::NeighborDatabase::NeighborEntry::reset(), dtn::core::WallClock::timeout(), dtn::api::Registration::underflow(), dtn::daemon::DTNTPWorker::update(), and dtn::core::BundleCore::validate().
void dtn::utils::Clock::gettimeofday | ( | struct timeval * | tv | ) | [static] |
Get the time of the day like ::gettimeofday(), but correct the value by the known clock offset.
tv |
Definition at line 183 of file Clock.cpp.
References modify_clock, and timezone.
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), getTime(), getUnixTimestamp(), dtn::data::DTNTime::set(), setOffset(), settimeofday(), and dtn::daemon::DTNTPWorker::TimeSyncMessage::TimeSyncMessage().
size_t dtn::utils::Clock::getUnixTimestamp | ( | ) | [static] |
Definition at line 123 of file Clock.cpp.
References gettimeofday(), and timezone.
Referenced by dtn::routing::StaticRoutingExtension::notify(), dtn::daemon::DTNTPWorker::raiseEvent(), and dtn::core::WallClock::timeout().
bool dtn::utils::Clock::isExpired | ( | const dtn::data::Bundle & | b | ) | [static] |
Definition at line 76 of file Clock.cpp.
References dtn::data::PrimaryBlock::_lifetime, dtn::data::PrimaryBlock::_timestamp, dtn::data::Bundle::getBlock(), and dtn::data::AgeBlock::getSeconds().
Referenced by dtn::routing::ProphetRoutingExtension::AcknowledgementSet::purge(), dtn::routing::BaseRouter::raiseEvent(), and dtn::core::BundleCore::validate().
bool dtn::utils::Clock::isExpired | ( | size_t | timestamp, |
size_t | lifetime = 0 |
||
) | [static] |
void dtn::utils::Clock::setOffset | ( | struct timeval & | tv | ) | [static] |
set the local offset of the clock
tv |
Definition at line 134 of file Clock.cpp.
References gettimeofday(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, modify_clock, settimeofday(), and timezone.
void dtn::utils::Clock::settimeofday | ( | struct timeval * | tv | ) | [static] |
Tells the internal clock the offset to the common network time.
Definition at line 160 of file Clock.cpp.
References gettimeofday(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, modify_clock, and timezone.
Referenced by setOffset().
bool dtn::utils::Clock::badclock = false [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 83 of file Clock.h.
Referenced by getExpireTime(), dtn::daemon::Configuration::params(), and dtn::data::PrimaryBlock::relabel().
bool dtn::utils::Clock::modify_clock = false [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 89 of file Clock.h.
Referenced by gettimeofday(), dtn::daemon::Configuration::TimeSync::load(), setOffset(), and settimeofday().
float dtn::utils::Clock::quality = 0 [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 quality of time.
Definition at line 77 of file Clock.h.
Referenced by dtn::daemon::DTNTPWorker::callbackBundleReceived(), dtn::daemon::DTNTPWorker::DTNTPWorker(), dtn::data::BundleList::expire(), dtn::daemon::DTNTPWorker::raiseEvent(), dtn::daemon::Configuration::Security::TLSRequired(), dtn::daemon::DTNTPWorker::update(), and dtn::core::BundleCore::validate().
u_int32_t dtn::utils::Clock::TIMEVAL_CONVERSION = 946684800 [static] |
int dtn::utils::Clock::timezone = 0 [static] |
Definition at line 68 of file Clock.h.
Referenced by getTime(), gettimeofday(), getUnixTimestamp(), setGlobalVars(), setOffset(), and settimeofday().