LRAUV  revA
Timestamp Class Reference

Represents absolute times. More...

#include <Timestamp.h>

Inheritance diagram for Timestamp:
Collaboration diagram for Timestamp:

Public Member Functions

 Timestamp (const double &seconds)
 Constructor, set time from double. More...
 
 Timestamp (const int seconds, const unsigned int microseconds)
 Constructor, set time from separate seconds and microseconds. More...
 
 Timestamp (const int year, const int month, const int day, const int hour, const int minute, const int second)
 Constructor, set time from separate date and time integers. More...
 
 Timestamp (const struct timeval &timeval)
 Constructor, set time from struct timeval. More...
 
 Timestamp (const char *timeString)
 Constructor, set time from simple y,m,d, h,m,s type formats including ISO9601. More...
 
 Timestamp (const Timestamp &copyMe=NOT_SET_TIME)
 Copy constructor. More...
 
void addFromMicros (const long long &micros)
 add seconds << 20 + microseconds More...
 
void addFromMillis (const long long &millis)
 add seconds << 10 + microseconds >> 10 More...
 
void round (int seconds)
 
virtual ~Timestamp ()
 Destructor. More...
 
Timespan elapsed () const
 Returns the time elapsed since this timestamp. More...
 
virtual double asDouble () const
 Accessor, convert to double. More...
 
virtual double asFloat () const
 Accessor, convert to float. More...
 
long long asMicros () const
 Quickly returns the (seconds << 20) + microseconds (52 bits) More...
 
long long asMillis () const
 Quickly returns the (seconds << 10) + (microseconds >> 10) (42 bits) More...
 
time_t asTimeT () const
 
*struct tm asStructTm () const
 
Timestampoperator= (const Timestamp &rhs)
 Copy operator. More...
 
Timestampoperator= (const double &seconds)
 Set from double. More...
 
Timestampoperator= (const struct timeval &timeval)
 Set from struct timeval. More...
 
Timestampoperator+= (const Timespan &rhs)
 Addition with a Timespan. More...
 
Timestampoperator-= (const Timespan &rhs)
 Subtraction of a Timespan. More...
 
Timestamp operator+ (const Timespan &rhs) const
 Addition to Timespan. More...
 
Timestamp operator- (const Timespan &rhs) const
 Subtraction from Timespan. More...
 
Timespan operator- (const struct timeval &rhs) const
 Subtraction from struct timeval. More...
 
Timespan operator- (const Timestamp &rhs) const
 Subtraction of two times yields a timespan. More...
 
bool operator== (const Timestamp &rhs) const
 Equalities/inequalities. More...
 
bool operator!= (const Timestamp &rhs) const
 Equalities/inequalities. More...
 
bool operator> (const Timestamp &rhs) const
 Greater-than operator. More...
 
bool operator< (const Timestamp &rhs) const
 Less-than operator. More...
 
bool operator<= (const Timestamp &rhs) const
 Greater-than-equal operator. More...
 
bool operator>= (const Timestamp &rhs) const
 Less-than-equal operator. More...
 
TimestampsetToCurrentTime ()
 Set to the current time. More...
 
TimestampsetToMonoTime ()
 Set to clock that represents monotonic time since some unspecified starting point. More...
 
void sleepTill ()
 Sleep until the given time. More...
 
void toTimespec (struct timespec *) const
 Internal conversion function. More...
 
void fromTimespec (const struct timespec *in)
 Internal conversion function. More...
 
const struct timeval & getTimeval () const
 Get the internal storage. More...
 
const char * toString (char *buf, int buflen, int precision=3) const
 Writes the Timestamp as to a unsigned char buffer. More...
 
const Str toString (int precision=3) const
 Writes the Timestamp as a Str. More...
 
const Str toSmallString () const
 Writes the Timestamp as a small Str (YYYYmmdd'T'HHMMSS). More...
 
const Str toSmallerString () const
 Writes the Timestamp as a smaller Str (YYYYmmddHHMM). More...
 
const Str toDateHourString () const
 Writes the Timestamp as a date-hour Str (YYYYmmddHH). More...
 

Static Public Member Functions

static Timestamp FromMicros (const long long &micros)
 Named Constructor, set from seconds << 20 + microseconds,. More...
 
static Timestamp FromMillis (const long long &millis)
 Named Constructor, set from seconds << 10 + milliseconds >> 10. More...
 
static Timestamp Now ()
 Static for current time for use on RHS. More...
 

Public Attributes

*int tm_min
 Returns value as struct tm: int tm_sec; /* seconds. More...
 
*int tm_hour
 
*int tm_mday
 
*int tm_mon
 
*int tm_year
 
*int tm_wday
 
*int tm_yday
 
*int tm_isdst
 

Static Public Attributes

static const Timestamp NOT_SET_TIME
 Constant value to represent "no time". More...
 
static const Timestamp EPOCH_START_TIME
 Constant value to represent beginning of (1970 Jan 1) epoch. More...
 

Protected Member Functions

struct timeval & fromDouble (const double &seconds)
 Set the internal storage to the specified value. More...
 
struct timeval & fromIntegers (const int seconds, const unsigned int microseconds)
 Set the internal storage to the specified values. More...
 
struct timeval & fromIntegers (const int year, const int month, const int day, const int hour, const int minute, const int second)
 Set the internal storage to the specified values. More...
 
struct timeval & fromString (const char *timeString)
 Set the internal storage to the specified ISO9601 string value. More...
 

Static Protected Member Functions

static struct timeval TimevalFromIntegers (const int seconds, const unsigned int microseconds)
 Returns a struct timeval from the specified values. More...
 
static struct timeval TimevalFromMicros (const long long &micros)
 Returns a struct timeval from asMicros() result. More...
 
static struct timeval TimevalFromMillis (const long long &millis)
 Returns a struct timeval from asMillis() result. More...
 

Protected Attributes

struct timeval timeval_
 Internal storage for time. More...
 

Detailed Description

Represents absolute times.

Accomplishes two goals. First, it provides a first-class abstraction for storing time/date information, including sensical access and math functions.

Second, it abstracts many time-related library calls (current time, sleep) through a controlled interface. We can then manipulate this interface behind the scenes to do faster- than-realtime simulation.

Constructor & Destructor Documentation

Timestamp::Timestamp ( const double &  seconds)

Constructor, set time from double.

Constructor, set from seconds.

Referenced by FromMicros(), FromMillis(), Now(), operator+(), and operator-().

Timestamp::Timestamp ( const int  seconds,
const unsigned int  microseconds 
)

Constructor, set time from separate seconds and microseconds.

Timestamp::Timestamp ( const int  year,
const int  month,
const int  day,
const int  hour,
const int  minute,
const int  second 
)

Constructor, set time from separate date and time integers.

Timestamp::Timestamp ( const struct timeval &  timeval)

Constructor, set time from struct timeval.

Timestamp::Timestamp ( const char *  timeString)

Constructor, set time from simple y,m,d, h,m,s type formats including ISO9601.

Constructor, set time from ISO9601 string.

Timestamp::Timestamp ( const Timestamp rhs = NOT_SET_TIME)

Copy constructor.

Tests:

  1. Create new object copied from another object.

    asDouble == asDouble

  2. Create new object copied from another object. Equal with == operator
virtual Timestamp::~Timestamp ( )
inlinevirtual

Destructor.

Member Function Documentation

void Timestamp::addFromMicros ( const long long &  micros)

add seconds << 20 + microseconds

References __suseconds_t, __time_t, and timeval_.

Referenced by LogEntry::ReadTimestamp().

void Timestamp::addFromMillis ( const long long &  millis)

add seconds << 10 + microseconds >> 10

References __suseconds_t, __time_t, and timeval_.

Referenced by LogEntry::ReadTimestamp().

double Timestamp::asFloat ( ) const
virtual

Accessor, convert to float.

Reimplemented in Timespan.

References timeval_.

Referenced by Timespan::asFloat().

long long Timestamp::asMicros ( ) const

Quickly returns the (seconds << 20) + microseconds (52 bits)

Quickly returns the (seconds << 20) + microseconds.

References timeval_.

Referenced by EventEntry::write().

long long Timestamp::asMillis ( ) const

Quickly returns the (seconds << 10) + (microseconds >> 10) (42 bits)

Quickly returns the (seconds << 10) + (microseconds >> 10)

References timeval_.

Referenced by AnalogToDigital::readCounts(), and Rowe_600LCM::runnable().

*struct tm Timestamp::asStructTm ( ) const
time_t Timestamp::asTimeT ( ) const
inline
Timespan Timestamp::elapsed ( ) const

Returns the time elapsed since this timestamp.

References Now().

Referenced by ESPClient::advanceInteraction(), GoToSurface::calcSatisfied(), ESPClient::checkCmdCompleteTimeout(), ESPClient::checkCmdResultTimeout(), CBIT::checkDepth(), CBIT::checkLocation(), GoToSurface::checkPitchAndAltitude(), NAL9602::cmdMode(), CommandLine::commandIbitMcp3553(), ESPClient::consumeResult(), DataOverHttps::dataRead(), CBIT::empiricalFaultClassification(), ValueClause::evalSide(), ESPComponent::getLine(), NAL9602::getMTQueueSignalStrength(), NAL9602::getReceivedSignalStrength(), CANONSampler::getSimulatedData(), ESPComponent::getSimulatedData(), AcousticModem_Benthos_ATM900::gotNewQuery(), DAT::gotNewQuery(), CBIT::handleComponentFaults(), ESPClient::handleException(), BuoyancyServo::isNeeded(), ReadDataComponent::isSatisfied(), CBIT::monitorBatteryTemps(), CBIT::monitorEnvironmentals(), NAL9602::needFix(), VerticalControl::overrideVertical(), NAL9602::pause(), BPC1::pausing(), CTD_NeilBrown::preprocessData(), LogEngine::processQueue(), ExternalSim::publishState(), UartStream::read(), AnalogToDigital::readCounts(), Navigator::readExternalFix(), UartStream::readUntil(), Navigator::readVehicleOrientation(), DeadReckonUsingMultipleVelocitySources::readVehicleVelocity(), Turbulence_NPS::receive(), NAL9602::requestFix(), NAL9602::requestGSV(), LoadControl::requestVoltageAndCurrent(), MassServo::resuming(), PNI_TCM::resuming(), DropWeight::run(), NavChartDb::run(), Batt_Ocean_Server::run(), IBIT::run(), SBIT::run(), HFRadarModelPoint::run(), DataOverHttps::run(), InternalSim::run(), NavigationSim::run(), Tracking::run(), MissionItem::run(), GoToSurface::runIfUnsatisfied(), OffshoreEnvelope::runIfUnsatisfied(), MissionItem::runIfUnsatisfied(), DVL_micro::runnable(), SCPI::runnable(), MassServo::runnable(), Aanderaa_O2::runnable(), CANONSampler::runnable(), ISUS::runnable(), Radio_Surface::runnable(), AcousticModem_Benthos_ATM900::runnable(), WetLabsBB2FL::runnable(), DAT::runnable(), PNI_TCM::runnable(), ThrusterServo::runnable(), AHRS_3DMGX3::runnable(), CTD_NeilBrown::runnable(), Rowe_600LCM::runnable(), BPC1::runnable(), Rowe_600::runnable(), MissionItem::satisfied(), CBIT::scanGFChan(), NAL9602::sendingTransmit(), NAL9602::sendingVerify(), UartStream::serGetChar(), NAL9602::sessionMTQueueVerify(), DataOverHttps::sslConnecting(), AcousticModem_Benthos_ATM900::start(), DAT::start(), NAL9602::start(), SCPI::starting(), ElevatorServo::starting(), MassServo::starting(), RudderServo::starting(), BuoyancyServo::starting(), Aanderaa_O2::starting(), ISUS::starting(), Radio_Surface::starting(), AcousticModem_Benthos_ATM900::starting(), DVL_micro::starting(), WetLabsBB2FL::starting(), DAT::starting(), ESPComponent::starting(), ThrusterServo::starting(), PNI_TCM::starting(), AHRS_sp3003D::starting(), Rowe_600LCM::starting(), BPC1::starting(), Rowe_600::starting(), NAL9602::starting(), Rowe_600::stop(), Radio_Surface::stopped(), BuoyancyServo::stopping(), CANONSampler::stopping(), PNI_TCM::stopping(), AHRS_sp3003D::stopping(), DataOverHttps::tcpConnecting(), NavChartDb::updateClosest(), UartStream::waitForBufferEmpty(), ESPComponent::waitForESPConnection(), and Navigator::writeVehiclePosition().

struct timeval & Timestamp::fromDouble ( const double &  seconds)
protected

Set the internal storage to the specified value.

References __suseconds_t, __time_t, and timeval_.

Referenced by operator=().

struct timeval & Timestamp::fromIntegers ( const int  seconds,
const unsigned int  microseconds 
)
protected

Set the internal storage to the specified values.

References __suseconds_t, __time_t, and timeval_.

struct timeval & Timestamp::fromIntegers ( const int  year,
const int  month,
const int  day,
const int  hour,
const int  minute,
const int  second 
)
protected

Set the internal storage to the specified values.

References timeval_.

Timestamp Timestamp::FromMicros ( const long long &  micros)
static

Named Constructor, set from seconds << 20 + microseconds,.

Named Constructor, set from seconds << 20 + microseconds.

References Timestamp(), and TimevalFromMicros().

Referenced by EventEntry::Read().

Timestamp Timestamp::FromMillis ( const long long &  millis)
static

Named Constructor, set from seconds << 10 + milliseconds >> 10.

References Timestamp(), and TimevalFromMillis().

struct timeval & Timestamp::fromString ( const char *  timeString)
protected

Set the internal storage to the specified ISO9601 string value.

References NOT_SET_TIME, and timeval_.

void Timestamp::fromTimespec ( const struct timespec *  in)

Internal conversion function.

References timeval_.

Referenced by setToMonoTime().

const struct timeval& Timestamp::getTimeval ( ) const
inline

Get the internal storage.

References timeval_.

Referenced by operator=().

Timestamp Timestamp::Now ( )
static

Static for current time for use on RHS.

Static function.

References Timestamp().

Referenced by MissionItem::addCall(), ConfigDataElement::applyConfigValue(), BPC1::BPC1(), Wait::calcSatisfied(), CBIT::checkDepth(), CBIT::checkLocation(), GoToSurface::checkPitchAndAltitude(), CommandLine::commandBang(), CommandLine::commandBurn(), CommandLine::commandIbitMcp3553(), CommandLine::commandSchedule(), CommandLine::commandStop(), DataOverHttps::dataRead(), ScheduledItem::DoScheduled(), elapsed(), CBIT::empiricalFaultClassification(), Component::execute(), Behavior::executeIfUnsatisfied(), HDF5File::finalize(), Supervisor::GenerateDataDir(), CommandLine::getLines(), PNI_TCM::getMagneticVariation(), NAL9602::getMTQueueSignalStrength(), NAL9602::getReceivedSignalStrength(), CANONSampler::getSimulatedData(), CTD_NeilBrown::getSimulatedData(), ESPComponent::getSimulatedData(), DAT::getSimulatedMeasurements(), NAL9602::goToSleep(), DeadReckonUsingSpeedCalculator::initialize(), DeadReckonWithRespectToWater::initialize(), DeadReckonUsingDVLWaterTrack::initialize(), DeadReckonWithRespectToSeafloor::initialize(), DeadReckonUsingCompactModelForecast::initialize(), Batt_Ocean_Server::initialize(), SBIT::initialize(), HFRadarModelPoint::initialize(), VerticalControl::initialize(), DeadReckonUsingMultipleVelocitySources::initialize(), OffshoreEnvelope::initialize(), CBIT::initialize(), ReadDataComponent::initialize(), ExternalSim::initialize(), Tracking::initialize(), MissionItem::initialize(), ESPClient::issueCommand(), HFRadarCompactModelForecaster::loadHistory(), LogEntry::LogEntry(), HFRadarModelCalc::lookup(), HFRCMSurfaceCurrentAtVehicleLocation::lookupExpansionCoefficients(), HFRCMVirtualSurfaceDrifter::lookupExpansionCoefficients(), CBIT::monitorBatteryTemps(), CBIT::monitorEnvironmentals(), NAL9602::NAL9602(), NAL9602::needFix(), Reporter::ReportItem::needsReporting(), VerticalControl::overrideVertical(), AcousticModem_Benthos_ATM900::parseDebugRxMessage(), AcousticModem_Benthos_ATM900::parseDebugTxMessage(), BPC1::pause(), NAL9602::paused(), BPC1::pausing(), LogEngine::processQueue(), HFRadarCompactModelForecaster::publishForecast(), ExternalSim::publishState(), HFRCMReconstructedInterpolator::publishSurfaceCurrentAtVehicleLocation(), HFRadarModelCalc::publishSurfaceCurrentAtVehicleLocation(), Tracking::queryDAT(), UartStream::read(), AnalogToDigital::readCounts(), Rowe_600::readEnsemble(), UartStream::readUntil(), Navigator::readVehicleOrientation(), DeadReckonUsingSpeedCalculator::readVehicleVelocity(), DeadReckonWithRespectToWater::readVehicleVelocity(), DeadReckonWithRespectToSeafloor::readVehicleVelocity(), DeadReckonUsingCompactModelForecast::readVehicleVelocity(), DeadReckonUsingMultipleVelocitySources::readVehicleVelocity(), Turbulence_NPS::receive(), Reporter::ReportItem::report(), Reporter::ReportItem::ReportItem(), ReadDataComponent::requestData(), NAL9602::requestFix(), NAL9602::requestGSV(), AcousticModem_Benthos_ATM900::requestRange(), DAT::requestRange(), LoadControl::requestVoltageAndCurrent(), GoToSurface::resetTimeouts(), MassServo::resume(), AcousticModem_Benthos_ATM900::resume(), DAT::resume(), PNI_TCM::resume(), BPC1::resume(), Rowe_600::resume(), Turbulence_NPS::resuming(), PNI_TCM::resuming(), CTD_NeilBrown::resuming(), Rowe_600::resuming(), CycleStarter::run(), Assign::run(), SendDataComponent::run(), DropWeight::run(), PAR_Licor::run(), NavChartDb::run(), DeadReckoner::run(), Batt_Ocean_Server::run(), IBIT::run(), SBIT::run(), HFRadarModelCalc::run(), HFRCMSurfaceCurrentAtVehicleLocation::run(), DataOverHttps::run(), HFRCMVirtualSurfaceDrifter::run(), Handler::runBetween(), Wait::runIfUnsatisfied(), PeakDetectVsDepth::runIfUnsatisfied(), ValueDetect::runIfUnsatisfied(), OffshoreEnvelope::runIfUnsatisfied(), DVL_micro::runnable(), SCPI::runnable(), CANONSampler::runnable(), BuoyancyServo::runnable(), ISUS::runnable(), VemcoVR2C::runnable(), Turner_Cyclops_rhodamine::runnable(), Aanderaa_O2::runnable(), Radio_Surface::runnable(), AcousticModem_Benthos_ATM900::runnable(), WetLabsBB2FL::runnable(), DAT::runnable(), ESPComponent::runnable(), ThrusterServo::runnable(), AHRS_3DMGX3::runnable(), PNI_TCM::runnable(), CTD_NeilBrown::runnable(), AHRS_sp3003D::runnable(), Rowe_600LCM::runnable(), BPC1::runnable(), Rowe_600::runnable(), Handler::runOnce(), CBIT::scanGFChan(), NAL9602::sendingFillBuffer(), NAL9602::sendingTransmit(), UartStream::serGetChar(), AHRS_sp3003D::setCalMode(), ESPComm::setEspLogFile(), Component::setFailure(), HFRCMVirtualSurfaceDrifter::setLocation(), DataElement::setTimestamp(), sleepTill(), SCPI::start(), ElevatorServo::start(), MassServo::start(), ISUS::start(), RudderServo::start(), BuoyancyServo::start(), Aanderaa_O2::start(), Radio_Surface::start(), AcousticModem_Benthos_ATM900::start(), WetLabsBB2FL::start(), Turbulence_NPS::start(), DAT::start(), DVL_micro::start(), AHRS_3DMGX3::start(), PNI_TCM::start(), ThrusterServo::start(), CTD_NeilBrown::start(), AHRS_sp3003D::start(), Rowe_600LCM::start(), BPC1::start(), Rowe_600::start(), NAL9602::start(), MassServo::starting(), ElevatorServo::starting(), BuoyancyServo::starting(), Aanderaa_O2::starting(), ISUS::starting(), RudderServo::starting(), WetLabsBB2FL::starting(), ESPComponent::starting(), AHRS_3DMGX3::starting(), ThrusterServo::starting(), PNI_TCM::starting(), AHRS_sp3003D::starting(), BPC1::starting(), DVL_micro::startPing(), AnalogToDigital::startRead(), ESPClient::startSampling(), ESPComponent::startSamplingPhase(), BuoyancyServo::stop(), CANONSampler::stop(), AcousticModem_Benthos_ATM900::stop(), DAT::stop(), PNI_TCM::stop(), AHRS_sp3003D::stop(), Radio_Surface::stopping(), DataOverHttps::tcpConnect(), Timestamp_Test::testNow(), Timespan_Test::testSleepFor(), Timestamp_Test::testSleepNow(), Timestamp_Test::testToString(), AcousticModem_Benthos_ATM900::uninitialize(), DAT::uninitialize(), NAL9602::uninitialize(), NavChartDb::updateClosest(), UartStream::waitForBufferEmpty(), ESPComponent::waitForESPConnection(), NAL9602::waking(), VerticalTemperatureHomogeneityIndexCalculator::writeData(), DVL_micro::writeData(), Tracking::writeData(), and HFRadarModelCalc::writeExpansionCoefficientsToSlate().

bool Timestamp::operator!= ( const Timestamp rhs) const

Equalities/inequalities.

References timeval_.

Timestamp Timestamp::operator+ ( const Timespan rhs) const

Addition to Timespan.

Standard addition/subtraction functions.

I do wonder if i could return a Timestamp object rather than a stack double. Hmm...

Tests for each:

  1. Create double A and B (A>B). Create timeA, timeB and timespanB.
  2. Verify timeA+timespanB = A+B
  3. Verify timeA-timespanB = A-B
  4. Verify timeA - timeB = A-B
  5. Verify timeA + B = A+B
  6. Verify timeA - B = A-B
  7. Repeat above with B>A

References Timestamp(), and timeval_.

Timestamp & Timestamp::operator+= ( const Timespan rhs)

Addition with a Timespan.

Addition of a Timespan.

Tests:

  1. Create to time objects params A and Timespan B. Sum objects A+=B. Verify (A+B).asDouble() == (A.asDouble + B.asDouble )

References timeval_.

Timestamp Timestamp::operator- ( const Timespan rhs) const

Subtraction from Timespan.

References Timestamp(), and timeval_.

Referenced by sleepTill().

Timespan Timestamp::operator- ( const struct timeval &  rhs) const

Subtraction from struct timeval.

References timeval_.

Timespan Timestamp::operator- ( const Timestamp rhs) const

Subtraction of two times yields a timespan.

References timeval_.

Timestamp & Timestamp::operator-= ( const Timespan rhs)

Subtraction of a Timespan.

Tests:

  1. Create to time objects params A and Timespan B. Sum objects A-=B. Verify (A-B).asDouble() == (A.asDouble - B.asDouble )

References timeval_.

bool Timestamp::operator< ( const Timestamp rhs) const

Less-than operator.

References timeval_.

bool Timestamp::operator<= ( const Timestamp rhs) const

Greater-than-equal operator.

References timeval_.

Timestamp & Timestamp::operator= ( const Timestamp rhs)

Copy operator.

Tests:

  1. Create two objects with different double params. Test they are different. Use copy to set one to the other. Test they are same with equality operator.

References getTimeval(), and timeval_.

Timestamp & Timestamp::operator= ( const double &  seconds)

Set from double.

Set operator.

Tests:

  1. Create object with double param A. Test asDouble is not equal to B. Use operator to set to B. Test asDouble is equal to B
  2. Create two objects with different double params. Test they are different. Use copy to set one to the other's asDouble. Test they are same with equality operator.

References fromDouble().

Timestamp & Timestamp::operator= ( const struct timeval &  timeval)

Set from struct timeval.

Set operator.

References timeval_.

bool Timestamp::operator== ( const Timestamp rhs) const

Equalities/inequalities.

Comparison operator.

References timeval_.

bool Timestamp::operator> ( const Timestamp rhs) const

Greater-than operator.

Inequality operator.

Tests:

  1. Generate two times A and B with A > B. Verify A>B true and A<B false.

References timeval_.

bool Timestamp::operator>= ( const Timestamp rhs) const

Less-than-equal operator.

References timeval_.

Timestamp & Timestamp::setToCurrentTime ( void  )

Set to the current time.

Set this object to current time.

Tests:

  1. First, check that it works (returns correctly)
  2. Then, get time, sleep a period, and get time again. Verify two times are sleep period within some delta.
  3. (Don't know how to test failure conditions)

References timeval_.

Timestamp & Timestamp::setToMonoTime ( void  )

Set to clock that represents monotonic time since some unspecified starting point.

References fromTimespec().

void Timestamp::sleepTill ( void  )

Sleep until the given time.

Quite a few ways to run this algorithm.

What's the most precise under standard Linux

Tests:

  1. None defined

References Now(), operator-(), and Timespan::sleepFor().

Referenced by Handler::runBetween(), and Timestamp_Test::testSleepNow().

struct timeval Timestamp::TimevalFromIntegers ( const int  seconds,
const unsigned int  microseconds 
)
staticprotected

Returns a struct timeval from the specified values.

References __suseconds_t, and __time_t.

struct timeval Timestamp::TimevalFromMicros ( const long long &  micros)
staticprotected

Returns a struct timeval from asMicros() result.

References __suseconds_t, and __time_t.

Referenced by FromMicros(), and Timespan::FromMicros().

struct timeval Timestamp::TimevalFromMillis ( const long long &  millis)
staticprotected

Returns a struct timeval from asMillis() result.

References __suseconds_t, and __time_t.

Referenced by FromMillis(), and Timespan::FromMillis().

const Str Timestamp::toDateHourString ( ) const

Writes the Timestamp as a date-hour Str (YYYYmmddHH).

References timeval_.

Referenced by Rowe_600::appendEnsembleToFile().

const Str Timestamp::toSmallerString ( ) const

Writes the Timestamp as a smaller Str (YYYYmmddHHMM).

References timeval_.

Referenced by HFRadarCompactModelForecaster::publishForecast(), and Unserialize::Run().

const Str Timestamp::toString ( int  precision = 3) const

Writes the Timestamp as a Str.

References toString().

void Timestamp::toTimespec ( struct timespec *  out) const

Internal conversion function.

References timeval_.

Referenced by Timespan::sleepFor(), and ThreadCondition::timedWait().

Member Data Documentation

const Timestamp Timestamp::EPOCH_START_TIME
static

Constant value to represent beginning of (1970 Jan 1) epoch.

Referenced by ScheduledItem::AddTimed(), CommandLine::commandSchedule(), ScheduledItem::DoScheduled(), and ScheduledItem::List().

* int Timestamp::tm_hour
* int Timestamp::tm_isdst
* int Timestamp::tm_mday
* int Timestamp::tm_min

Returns value as struct tm: int tm_sec; /* seconds.

* int Timestamp::tm_mon
* int Timestamp::tm_wday
* int Timestamp::tm_yday
* int Timestamp::tm_year

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