E-MailRelay
Public Types | Public Member Functions | Static Public Member Functions | List of all members
G::TimeInterval Class Reference

An interval between two G::SystemTime values or two G::TimerTime values. More...

#include <gdatetime.h>

Public Types

using s_type = unsigned int
 
using us_type = unsigned int
 

Public Member Functions

 TimeInterval (unsigned int s, unsigned int us=0U)
 Constructor. More...
 
 TimeInterval (const SystemTime &start, const SystemTime &end)
 Constructor. More...
 
 TimeInterval (const TimerTime &start, const TimerTime &end)
 Constructor. Overload for TimerTime. More...
 
unsigned int s () const
 Returns the number of seconds. More...
 
unsigned int us () const
 Returns the fractional microseconds part. More...
 
void streamOut (std::ostream &) const
 Streams out the interval. More...
 
bool operator< (const TimeInterval &) const
 Comparison operator. More...
 
bool operator<= (const TimeInterval &) const
 Comparison operator. More...
 
bool operator== (const TimeInterval &) const
 Comparison operator. More...
 
bool operator!= (const TimeInterval &) const
 Comparison operator. More...
 
bool operator> (const TimeInterval &) const
 Comparison operator. More...
 
bool operator>= (const TimeInterval &) const
 Comparison operator. More...
 
TimeInterval operator+ (const TimeInterval &) const
 Returns the combined interval. Throws on overflow. More...
 
TimeInterval operator- (const TimeInterval &) const
 Returns the interval difference. Throws on underflow. More...
 
void operator+= (TimeInterval)
 Adds the given interval. Throws on overflow. More...
 
void operator-= (TimeInterval)
 Subtracts the given interval. Throws on underflow. More...
 

Static Public Member Functions

static TimeInterval zero ()
 Factory function for the zero interval. More...
 
static TimeInterval limit ()
 Factory function for the maximum valid interval. More...
 

Detailed Description

An interval between two G::SystemTime values or two G::TimerTime values.

Definition at line 288 of file gdatetime.h.

Member Typedef Documentation

◆ s_type

using G::TimeInterval::s_type = unsigned int

Definition at line 291 of file gdatetime.h.

◆ us_type

using G::TimeInterval::us_type = unsigned int

Definition at line 292 of file gdatetime.h.

Constructor & Destructor Documentation

◆ TimeInterval() [1/3]

G::TimeInterval::TimeInterval ( unsigned int  s,
unsigned int  us = 0U 
)
explicit

Constructor.

Definition at line 485 of file gdatetime.cpp.

◆ TimeInterval() [2/3]

G::TimeInterval::TimeInterval ( const SystemTime start,
const SystemTime end 
)

Constructor.

Constructs a zero interval if 'end' is before 'start', and the limit() interval if 'end' is too far ahead of 'start' for the underlying type.

Definition at line 492 of file gdatetime.cpp.

◆ TimeInterval() [3/3]

G::TimeInterval::TimeInterval ( const TimerTime start,
const TimerTime end 
)

Constructor. Overload for TimerTime.

Definition at line 502 of file gdatetime.cpp.

Member Function Documentation

◆ limit()

G::TimeInterval G::TimeInterval::limit ( )
static

Factory function for the maximum valid interval.

Definition at line 527 of file gdatetime.cpp.

◆ operator!=()

bool G::TimeInterval::operator!= ( const TimeInterval other) const

Comparison operator.

Definition at line 553 of file gdatetime.cpp.

◆ operator+()

G::TimeInterval G::TimeInterval::operator+ ( const TimeInterval other) const

Returns the combined interval. Throws on overflow.

Definition at line 578 of file gdatetime.cpp.

◆ operator+=()

void G::TimeInterval::operator+= ( TimeInterval  i)

Adds the given interval. Throws on overflow.

Definition at line 601 of file gdatetime.cpp.

◆ operator-()

G::TimeInterval G::TimeInterval::operator- ( const TimeInterval other) const

Returns the interval difference. Throws on underflow.

Definition at line 585 of file gdatetime.cpp.

◆ operator-=()

void G::TimeInterval::operator-= ( TimeInterval  i)

Subtracts the given interval. Throws on underflow.

Definition at line 620 of file gdatetime.cpp.

◆ operator<()

bool G::TimeInterval::operator< ( const TimeInterval other) const

Comparison operator.

Definition at line 558 of file gdatetime.cpp.

◆ operator<=()

bool G::TimeInterval::operator<= ( const TimeInterval other) const

Comparison operator.

Definition at line 563 of file gdatetime.cpp.

◆ operator==()

bool G::TimeInterval::operator== ( const TimeInterval other) const

Comparison operator.

Definition at line 548 of file gdatetime.cpp.

◆ operator>()

bool G::TimeInterval::operator> ( const TimeInterval other) const

Comparison operator.

Definition at line 568 of file gdatetime.cpp.

◆ operator>=()

bool G::TimeInterval::operator>= ( const TimeInterval other) const

Comparison operator.

Definition at line 573 of file gdatetime.cpp.

◆ s()

G::TimeInterval::s_type G::TimeInterval::s ( ) const

Returns the number of seconds.

Definition at line 538 of file gdatetime.cpp.

◆ streamOut()

void G::TimeInterval::streamOut ( std::ostream &  stream) const

Streams out the interval.

Definition at line 632 of file gdatetime.cpp.

◆ us()

G::TimeInterval::us_type G::TimeInterval::us ( ) const

Returns the fractional microseconds part.

Definition at line 543 of file gdatetime.cpp.

◆ zero()

G::TimeInterval G::TimeInterval::zero ( )
static

Factory function for the zero interval.

Definition at line 533 of file gdatetime.cpp.


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