class Interval

Time interval class.

Public Methods

Interval()
Default constructor
Interval(long sec, ulong_t nsec)
Constructor from seconds and nanoseconds
Interval(double sec)
Constructor from a double (in seconds)
Interval(const Interval& dt)
Copy constructor
Interval& operator= (const Interval& dt)
Assignment operator
operator double(void) const
Cast to double
friend std::ostream& operator <<(std::ostream &out, const Interval& t)
Format the Interval to ostream
Interval operator +=(const Interval& dt)
Add an interval to another
Interval operator -=(const Interval& dt)
Subtract an Interval
Interval operator *=(double dt)
Multiply Interval by a double constant
double operator /(const Interval& div) const
Divide an Interval by an Interval
Interval operator /=(double dt)
Divide a Interval by a double constant
bool operator!(void) const
Test for zero
bool operator ==(const Interval& rhs) const
Compare Intervals (equality)
bool operator !=(const Interval& rhs) const
Compare Intervals (inequality)
bool operator >=(const Interval& rhs) const
Compare Intervals (Greater or Equal)
bool operator <=(const Interval& rhs) const
Compare Intervals (Less or equal)
bool operator >(const Interval& rhs) const
Compare Intervals (Greater)
bool operator <(const Interval& rhs) const
Compare Intervals (Less than)
long GetS() const
Get seconds field.
ulong_t GetN() const
Get nano-second.
double GetSecs() const
Return the interval time in seconds
void SetS(ulong_t s)
Set second
void SetN(ulong_t n)
Set nano-second

Documentation

The Interval class represents time intervals. This class complements and is compatible with the Time class which represents absolute GPS times. At present, intervals are represented as double-precision floating point numbers. This gives about 53-bits to the representation which corresponds to a precision of 1 in or <1ns for intervals of up to ~100 days.
Interval()
Default constructor

Interval(long sec, ulong_t nsec)
Constructor from seconds and nanoseconds

Interval(double sec)
Constructor from a double (in seconds)

Interval(const Interval& dt)
Copy constructor

Interval& operator= (const Interval& dt)
Assignment operator

operator double(void) const
Cast to double

friend std::ostream& operator <<(std::ostream &out, const Interval& t)
Format the Interval to ostream

Interval operator +=(const Interval& dt)
Add an interval to another

Interval operator -=(const Interval& dt)
Subtract an Interval

Interval operator *=(double dt)
Multiply Interval by a double constant

double operator /(const Interval& div) const
Divide an Interval by an Interval

Interval operator /=(double dt)
Divide a Interval by a double constant

bool operator!(void) const
Test for zero

bool operator ==(const Interval& rhs) const
Compare Intervals (equality)

bool operator !=(const Interval& rhs) const
Compare Intervals (inequality)

bool operator >=(const Interval& rhs) const
Compare Intervals (Greater or Equal)

bool operator <=(const Interval& rhs) const
Compare Intervals (Less or equal)

bool operator >(const Interval& rhs) const
Compare Intervals (Greater)

bool operator <(const Interval& rhs) const
Compare Intervals (Less than)

long GetS() const
Returns the floor of the number of seconds in the interval. Note that if the number is negative, the absolute value of the seconds field is GREATER than the absolute value of the interval.
Returns:
The integer floor of the interval in seconds.

ulong_t GetN() const
Offset in nanoseconds from the seconds field defined by GetS(). Note that the nanosecond field is always positive.
Returns:
Number of nanoseconds offset from the seconds field.

double GetSecs() const
Return the interval time in seconds

void SetS(ulong_t s)
Set second

void SetN(ulong_t n)
Set nano-second


This class has no child classes.
Author:
John. G. Zweizig
Version:
1.1; Last Modified: June 15, 1999

alphabetic index hierarchy of classes


generated by doc++