![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
#include <Fw/Time/TimeInterval.hpp>
Public Types | |
enum | { SERIALIZED_SIZE = sizeof(U32) * 2 } |
enum | Comparison { LT = -1, EQ = 0, GT = 1, INCOMPARABLE = 2 } |
The type of a comparison result. More... | |
![]() | |
using | SizeType = FwSizeType |
Public Member Functions | |
TimeInterval ()=default | |
~TimeInterval ()=default | |
TimeInterval (const TimeInterval &other) | |
TimeInterval (U32 seconds, U32 useconds) | |
TimeInterval (const Time &start, const Time &end) | |
void | set (U32 seconds, U32 useconds) |
U32 | getSeconds () const |
U32 | getUSeconds () const |
SerializeStatus | serializeTo (SerializeBufferBase &buffer) const override |
serialize contents to buffer More... | |
SerializeStatus | deserializeFrom (SerializeBufferBase &buffer) override |
deserialize contents from buffer More... | |
void | add (U32 seconds, U32 mseconds) |
bool | operator== (const TimeInterval &other) const |
bool | operator!= (const TimeInterval &other) const |
bool | operator> (const TimeInterval &other) const |
bool | operator< (const TimeInterval &other) const |
bool | operator>= (const TimeInterval &other) const |
bool | operator<= (const TimeInterval &other) const |
TimeInterval & | operator= (const TimeInterval &other) |
![]() | |
DEPRECATED (SerializeStatus serialize(SerializeBufferBase &buffer) const, "Use serializeTo(SerializeBufferBase& buffer) instead") | |
DEPRECATED (SerializeStatus deserialize(SerializeBufferBase &buffer), "Use deserializeFrom(SerializeBufferBase& buffer) instead") | |
Static Public Member Functions | |
static Comparison | compare (const TimeInterval &time1, const TimeInterval &time2) |
static TimeInterval | add (const TimeInterval &a, const TimeInterval &b) |
static TimeInterval | sub (const TimeInterval &t1, const TimeInterval &t2) |
Additional Inherited Members | |
![]() | |
Serializable () | |
Default constructor. More... | |
virtual | ~Serializable () |
destructor More... | |
Definition at line 20 of file TimeInterval.hpp.
anonymous enum |
Enumerator | |
---|---|
SERIALIZED_SIZE |
Definition at line 22 of file TimeInterval.hpp.
The type of a comparison result.
Enumerator | |
---|---|
LT | |
EQ | |
GT | |
INCOMPARABLE |
Definition at line 45 of file TimeInterval.hpp.
|
default |
|
default |
TimeInterval::TimeInterval | ( | const TimeInterval & | other | ) |
Definition at line 5 of file TimeInterval.cpp.
TimeInterval::TimeInterval | ( | U32 | seconds, |
U32 | useconds | ||
) |
Definition at line 9 of file TimeInterval.cpp.
Definition at line 13 of file TimeInterval.cpp.
void TimeInterval::add | ( | U32 | seconds, |
U32 | mseconds | ||
) |
Definition at line 122 of file TimeInterval.cpp.
|
static |
Add two time intervals Adds the seconds and microseconds fields of two time intervals together
a | TimeInterval a |
b | TimeInterval b |
Definition at line 93 of file TimeInterval.cpp.
|
static |
Compare two time intervals A time interval is considered greater than another if it spans a longer duration The comparison is done on the seconds first, then the microseconds if the seconds are equal
time1 | TimeInterval 1 |
time2 | TimeInterval 2 |
Definition at line 74 of file TimeInterval.cpp.
|
overridevirtual |
deserialize contents from buffer
Implements Fw::Serializable.
Definition at line 61 of file TimeInterval.cpp.
U32 TimeInterval::getSeconds | ( | ) | const |
Definition at line 66 of file TimeInterval.cpp.
U32 TimeInterval::getUSeconds | ( | ) | const |
Definition at line 70 of file TimeInterval.cpp.
bool TimeInterval::operator!= | ( | const TimeInterval & | other | ) | const |
Definition at line 34 of file TimeInterval.cpp.
bool TimeInterval::operator< | ( | const TimeInterval & | other | ) | const |
Definition at line 42 of file TimeInterval.cpp.
bool TimeInterval::operator<= | ( | const TimeInterval & | other | ) | const |
Definition at line 51 of file TimeInterval.cpp.
TimeInterval & TimeInterval::operator= | ( | const TimeInterval & | other | ) |
Definition at line 23 of file TimeInterval.cpp.
bool TimeInterval::operator== | ( | const TimeInterval & | other | ) | const |
Definition at line 30 of file TimeInterval.cpp.
bool TimeInterval::operator> | ( | const TimeInterval & | other | ) | const |
Definition at line 38 of file TimeInterval.cpp.
bool TimeInterval::operator>= | ( | const TimeInterval & | other | ) | const |
Definition at line 46 of file TimeInterval.cpp.
|
overridevirtual |
serialize contents to buffer
Implements Fw::Serializable.
Definition at line 56 of file TimeInterval.cpp.
void TimeInterval::set | ( | U32 | seconds, |
U32 | useconds | ||
) |
Definition at line 17 of file TimeInterval.cpp.
|
static |
Subtract two time intervals This computes the absolute value of the difference between two time intervals For example if t1=(0s, 5us) and t2=(0s, 3us), the result is (0s, 2us). This operation is commutative, i.e. the result is the same regardless of the order of the arguments.
t1 | TimeInterval 1 |
t2 | TimeInterval 2 |
Definition at line 105 of file TimeInterval.cpp.