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 304 of file gdatetime.h.

Member Typedef Documentation

◆ s_type

using G::TimeInterval::s_type = unsigned int

Definition at line 307 of file gdatetime.h.

◆ us_type

using G::TimeInterval::us_type = unsigned int

Definition at line 308 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 594 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 602 of file gdatetime.cpp.

◆ TimeInterval() [3/3]

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

Constructor. Overload for TimerTime.

Definition at line 613 of file gdatetime.cpp.

Member Function Documentation

◆ limit()

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

Factory function for the maximum valid interval.

Definition at line 638 of file gdatetime.cpp.

◆ operator!=()

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

Comparison operator.

Definition at line 665 of file gdatetime.cpp.

◆ operator+()

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

Returns the combined interval. Throws on overflow.

Definition at line 696 of file gdatetime.cpp.

◆ operator+=()

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

Adds the given interval. Throws on overflow.

Definition at line 722 of file gdatetime.cpp.

◆ operator-()

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

Returns the interval difference. Throws on underflow.

Definition at line 705 of file gdatetime.cpp.

◆ operator-=()

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

Subtracts the given interval. Throws on underflow.

Definition at line 741 of file gdatetime.cpp.

◆ operator<()

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

Comparison operator.

Definition at line 671 of file gdatetime.cpp.

◆ operator<=()

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

Comparison operator.

Definition at line 677 of file gdatetime.cpp.

◆ operator==()

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

Comparison operator.

Definition at line 659 of file gdatetime.cpp.

◆ operator>()

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

Comparison operator.

Definition at line 683 of file gdatetime.cpp.

◆ operator>=()

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

Comparison operator.

Definition at line 689 of file gdatetime.cpp.

◆ s()

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

Returns the number of seconds.

Definition at line 649 of file gdatetime.cpp.

◆ streamOut()

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

Streams out the interval.

Definition at line 753 of file gdatetime.cpp.

◆ us()

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

Returns the fractional microseconds part.

Definition at line 654 of file gdatetime.cpp.

◆ zero()

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

Factory function for the zero interval.

Definition at line 644 of file gdatetime.cpp.


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