Simple struct definition for bundle creation timestamps. More...
#include <BundleTimestamp.h>
Public Member Functions | |
BundleTimestamp () | |
Default constructor. | |
BundleTimestamp (u_int32_t seconds, u_int32_t seqno) | |
Constructor by parts. | |
bool | operator== (const BundleTimestamp &other) const |
Operator overload for use in STL data structures. | |
bool | operator< (const BundleTimestamp &other) const |
Operator overload for use in STL data structures. | |
bool | operator> (const BundleTimestamp &other) const |
Operator overload for use in STL data structures. | |
Static Public Member Functions | |
static u_int32_t | get_current_time () |
Return the current time in the correct format for the bundle protocol, i.e. | |
static bool | check_local_clock () |
Check that the local clock setting is valid (i.e. | |
Public Attributes | |
u_int32_t | seconds_ |
Seconds since 1/1/2000. | |
u_int32_t | seqno_ |
Sub-second sequence number. | |
Static Public Attributes | |
static u_int32_t | TIMEVAL_CONVERSION = 946684800 |
The number of seconds between 1/1/1970 and 1/1/2000. |
Simple struct definition for bundle creation timestamps.
Although quite similar to a struct timeval, the bundle protocol specification mandates that timestamps should be calculated as seconds since Jan 1, 2000 (not 1970) so we use a different type.
Definition at line 30 of file BundleTimestamp.h.
dtn::BundleTimestamp::BundleTimestamp | ( | ) | [inline] |
Default constructor.
Definition at line 37 of file BundleTimestamp.h.
dtn::BundleTimestamp::BundleTimestamp | ( | u_int32_t | seconds, | |
u_int32_t | seqno | |||
) | [inline] |
Constructor by parts.
Definition at line 43 of file BundleTimestamp.h.
bool dtn::BundleTimestamp::check_local_clock | ( | ) | [static] |
Check that the local clock setting is valid (i.e.
is at least up to date with the protocol.
Definition at line 44 of file BundleTimestamp.cc.
References dtnsim::gettimeofday(), log_err_p, and TIMEVAL_CONVERSION.
u_int32_t dtn::BundleTimestamp::get_current_time | ( | ) | [static] |
Return the current time in the correct format for the bundle protocol, i.e.
seconds since Jan 1, 2000 in UTC.
Definition at line 34 of file BundleTimestamp.cc.
References ASSERT, dtnsim::gettimeofday(), and TIMEVAL_CONVERSION.
Referenced by dtn::CustodySignal::create_custody_signal(), dtn::BundleStatusReport::create_status_report(), and dtn::Bundle::init().
bool dtn::BundleTimestamp::operator< | ( | const BundleTimestamp & | other | ) | const [inline] |
Operator overload for use in STL data structures.
Definition at line 70 of file BundleTimestamp.h.
bool dtn::BundleTimestamp::operator== | ( | const BundleTimestamp & | other | ) | const [inline] |
Operator overload for use in STL data structures.
Definition at line 61 of file BundleTimestamp.h.
bool dtn::BundleTimestamp::operator> | ( | const BundleTimestamp & | other | ) | const [inline] |
Operator overload for use in STL data structures.
Definition at line 80 of file BundleTimestamp.h.
u_int32_t dtn::BundleTimestamp::seconds_ |
Seconds since 1/1/2000.
Definition at line 31 of file BundleTimestamp.h.
Referenced by dtn::CustodySignal::create_custody_signal(), dtn::BundleStatusReport::create_status_report(), dtn::GbofId::equals(), dtn::ProphetBundleList::find(), dtn::BundleList::find(), dtn::Bundle::format_verbose(), dtn::PrimaryBlockProcessor::generate_primary(), dtn::FragmentManager::get_hash_key(), dtn::PrimaryBlockProcessor::get_primary_len(), dtn::APIClient::handle_cancel(), dtn::APIClient::handle_recv(), dtn::Bundle::init(), dtnsim::SimLog::log_entry(), operator<(), operator==(), operator>(), dtn::BundleStatusReport::parse_status_report(), dtn::Bundle::serialize(), dtn::GbofId::str(), and dtn::DTLSRRouter::update_current_lsa().
u_int32_t dtn::BundleTimestamp::seqno_ |
Sub-second sequence number.
Definition at line 32 of file BundleTimestamp.h.
Referenced by dtn::CustodySignal::create_custody_signal(), dtn::BundleStatusReport::create_status_report(), dtn::GbofId::equals(), dtn::ProphetBundleList::find(), dtn::BundleList::find(), dtn::Bundle::format_verbose(), dtn::PrimaryBlockProcessor::generate_primary(), dtn::FragmentManager::get_hash_key(), dtn::PrimaryBlockProcessor::get_primary_len(), dtn::APIClient::handle_cancel(), dtn::APIClient::handle_recv(), dtn::Bundle::init(), dtnsim::SimLog::log_entry(), operator<(), operator==(), operator>(), dtn::BundleStatusReport::parse_status_report(), dtn::Bundle::serialize(), and dtn::GbofId::str().
u_int32_t dtn::BundleTimestamp::TIMEVAL_CONVERSION = 946684800 [static] |
The number of seconds between 1/1/1970 and 1/1/2000.
Definition at line 90 of file BundleTimestamp.h.
Referenced by check_local_clock(), get_current_time(), and DTNSim::main().