org::xmlBlaster::util::TimestampFactory Class Reference

High performing timestamp class, time elapsed since 1970, the nanos are simulated as a unique counter. More...

Collaboration diagram for org::xmlBlaster::util::TimestampFactory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~TimestampFactory ()
Timestamp getTimestamp ()
 Constructs a current timestamp which is guaranteed to be unique in time for this process.

Static Public Member Functions

static TimestampFactorygetInstance ()
 The method to call to get the singleton Timestamp object.
static std::string toXml (Timestamp timestamp, const std::string &extraOffset="", bool literal=false)
static std::string getTimeAsString (Timestamp timestamp)

Friends

TimestampFactorygetInstance ()

Detailed Description

High performing timestamp class, time elapsed since 1970, the nanos are simulated as a unique counter.


The counter is rewound on any second step (this is different from its omonimous java class since there is no portable way in c++ to get the system time with a millisecond precision yet. Besides this difference, the c++ timestamp is a singleton working as a factory of timestamps (which are of the type long long -> typedef int64_t Timestamp;).
Guarantees that any created Timestamp instance is unique in the current process.

Fails only if

Author:
Marcel Ruff

Michele Laghi

Definition at line 48 of file Timestamp.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::TimestampFactory::~TimestampFactory (  ) 

Definition at line 37 of file Timestamp.cpp.


Member Function Documentation

static TimestampFactory& org::xmlBlaster::util::TimestampFactory::getInstance (  )  [static]

The method to call to get the singleton Timestamp object.

Timestamp org::xmlBlaster::util::TimestampFactory::getTimestamp (  ) 

Constructs a current timestamp which is guaranteed to be unique in time for this process.

Returns:
a 64 bit integer (typedef int64_t Timestamp)

Definition at line 48 of file Timestamp.cpp.

References org::xmlBlaster::util::thread::Thread::getCurrentTimestamp().

Referenced by org::xmlBlaster::util::Timeout::addTimeoutListener(), org::xmlBlaster::client::qos::SubscribeQos::generateSubscriptionId(), org::xmlBlaster::util::Global::getInstanceId(), org::xmlBlaster::util::qos::MsgQosData::getRemainingLife(), org::xmlBlaster::util::Timeout::run(), org::xmlBlaster::util::Timeout::spanToTimeout(), org::xmlBlaster::test::TestTimestamp::testTimestamp(), org::xmlBlaster::util::qos::StatusQosData::touchRcvTimestamp(), org::xmlBlaster::util::qos::QosData::touchRcvTimestamp(), and org::xmlBlaster::client::XmlBlasterAccess::XmlBlasterAccess().

static std::string org::xmlBlaster::util::TimestampFactory::toXml ( Timestamp  timestamp,
const std::string &  extraOffset = "",
bool  literal = false 
) [static]

Referenced by org::xmlBlaster::client::qos::GetReturnQos::getRcvTime().

string org::xmlBlaster::util::TimestampFactory::getTimeAsString ( Timestamp  timestamp  )  [static]

Definition at line 78 of file Timestamp.cpp.

References org::xmlBlaster::util::Constants::BILLION, and org::xmlBlaster::util::lexical_cast().


Friends And Related Function Documentation

TimestampFactory & org::xmlBlaster::util::TimestampFactory::getInstance (  )  [friend]

Definition at line 41 of file Timestamp.cpp.

Referenced by org::xmlBlaster::client::qos::SubscribeQos::generateSubscriptionId(), org::xmlBlaster::util::Global::getInstanceId(), org::xmlBlaster::util::qos::MsgQosData::getRemainingLife(), org::xmlBlaster::test::TestTimestamp::testTimestamp(), org::xmlBlaster::util::qos::StatusQosData::touchRcvTimestamp(), org::xmlBlaster::util::qos::QosData::touchRcvTimestamp(), and org::xmlBlaster::client::XmlBlasterAccess::XmlBlasterAccess().


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