IBR-DTNSuite  0.8
dtn::utils::Clock Class Reference

#include <Clock.h>

List of all members.

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

Detailed Description

Definition at line 20 of file Clock.h.


Member Function Documentation

size_t dtn::utils::Clock::getExpireTime ( size_t  timestamp,
size_t  lifetime 
) [static]

This method is deprecated because it does not recognize the AgeBlock as alternative age verification.

Definition at line 54 of file Clock.cpp.

size_t dtn::utils::Clock::getExpireTime ( size_t  lifetime) [static]

Returns the timestamp when this lifetime is going to be expired depending on the current knowledge of time.

Parameters:
lifetimeThe lifetime in seconds.
Returns:
A DTN timestamp.

Definition at line 59 of file Clock.cpp.

References getTime().

Here is the call graph for this function:

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.

Parameters:
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().

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().

Here is the call graph for this function:

bool dtn::utils::Clock::isExpired ( size_t  timestamp,
size_t  lifetime = 0 
) [static]

This method is deprecated because it does not recognize the AgeBlock as alternative age verification.

Definition at line 87 of file Clock.cpp.

void dtn::utils::Clock::setOffset ( struct timeval &  tv) [static]

set the local offset of the clock

Parameters:
tv

Definition at line 134 of file Clock.cpp.

References gettimeofday(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, modify_clock, settimeofday(), and timezone.

Here is the call graph for this function:

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().

Here is the call graph for this function:


Member Data Documentation

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]

The number of seconds between 1/1/1970 and 1/1/2000.

Definition at line 70 of file Clock.h.

Referenced by getTime().

int dtn::utils::Clock::timezone = 0 [static]

Definition at line 68 of file Clock.h.

Referenced by getTime(), gettimeofday(), getUnixTimestamp(), setGlobalVars(), setOffset(), and settimeofday().


The documentation for this class was generated from the following files: