WFMath  1.0.2
Public Member Functions | Friends | List of all members
WFMath::TimeDiff Class Reference

The difference between two timestamps. More...

#include <timestamp.h>

Public Member Functions

 TimeDiff ()
 construct an uninitialized TimeDiff
 
 TimeDiff (long msec)
 construct a TimeDiff of a given number of milliseconds
 
long milliseconds () const
 Get the value of a TimeDiff in milliseconds. More...
 
std::pair< long, long > full_time () const
 Get the value of a TimeDiff in (seconds, microseconds)
 
TimeDiff operator- () const
 negate a TimeDiff
 

Friends

TimeDiffoperator+= (TimeDiff &, const TimeDiff &)
 increment a TimeDiff
 
TimeDiffoperator-= (TimeDiff &, const TimeDiff &)
 decrement a TimeDiff
 
TimeDiff operator+ (const TimeDiff &a, const TimeDiff &b)
 add two TimeDiff instances
 
TimeDiff operator- (const TimeDiff &a, const TimeDiff &b)
 subtract two TimeDiff instances
 
TimeStampoperator+= (TimeStamp &, const TimeDiff &)
 advance a TimeStamp by a TimeDiff
 
TimeStampoperator-= (TimeStamp &, const TimeDiff &)
 regress a TimeStamp by a TimeDiff
 
TimeStamp operator+ (const TimeStamp &a, const TimeDiff &msec)
 find the result of advancing a TimeStamp
 
TimeStamp operator- (const TimeStamp &a, const TimeDiff &msec)
 find the result of regressing a TimeStamp
 
TimeDiff operator- (const TimeStamp &a, const TimeStamp &b)
 find the time difference between two time stamps
 

Detailed Description

The difference between two timestamps.

This class implements the 'generic' subset of the interface in the fake class Shape, with the exception of the stream operators. It also has the full set of comparison * operators (<, <=, >, >=, ==, !=).

Member Function Documentation

◆ milliseconds()

long WFMath::TimeDiff::milliseconds ( ) const

Get the value of a TimeDiff in milliseconds.

WARNING! This function does not check for overflow, if the number of milliseconds is large

Referenced by TimeDiff().


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