F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Os::IntervalTimer Class Reference

#include <Os/IntervalTimer.hpp>

Public Member Functions

 IntervalTimer ()
 Constructor. More...
 
 ~IntervalTimer ()=default
 Destructor. More...
 
void start ()
 Capture the start time of the interval. More...
 
void stop ()
 Capture the stop time of the interval. More...
 
U32 getDiffUsec () const
 Get the difference between start and stop times in microseconds. More...
 
Os::RawTime::Status getTimeInterval (Fw::TimeInterval &interval) const
 Get the time interval between the start and stop times. More...
 

Detailed Description

Definition at line 27 of file IntervalTimer.hpp.

Constructor & Destructor Documentation

◆ IntervalTimer()

Os::IntervalTimer::IntervalTimer ( )

Constructor.

Examples
/home/runner/work/fprime/fprime/Os/IntervalTimer.hpp.

Definition at line 11 of file IntervalTimer.cpp.

◆ ~IntervalTimer()

Os::IntervalTimer::~IntervalTimer ( )
default

Member Function Documentation

◆ getDiffUsec()

U32 Os::IntervalTimer::getDiffUsec ( ) const

Get the difference between start and stop times in microseconds.

This method calculates and returns the time difference between the start and stop times in microseconds. The start() and stop() methods must be called before calling this method.

Warning
Users should prefer the getTimeInterval() method for better error handling.
This function will return the maximum U32 value if the time difference is too large to fit in a U32.
This means the largest time difference that can be measured is 2^32 microseconds (about 71 minutes).
Returns
U32: The time difference in microseconds.
Examples
/home/runner/work/fprime/fprime/Os/IntervalTimer.hpp.

Definition at line 21 of file IntervalTimer.cpp.

◆ getTimeInterval()

Os::RawTime::Status Os::IntervalTimer::getTimeInterval ( Fw::TimeInterval interval) const

Get the time interval between the start and stop times.

This method calculates and returns the time interval between the recorded start and stop times as a Fw::TimeInterval object.

Parameters
interval[out] A reference to a Fw::TimeInterval object where the calculated interval will be stored.
Returns
bool: True if the interval was successfully calculated, false otherwise.
Examples
/home/runner/work/fprime/fprime/Os/IntervalTimer.hpp.

Definition at line 31 of file IntervalTimer.cpp.

◆ start()

void Os::IntervalTimer::start ( )

Capture the start time of the interval.

This method records the current time as the start time of the interval for this timer instance.

Examples
/home/runner/work/fprime/fprime/Os/IntervalTimer.hpp.

Definition at line 13 of file IntervalTimer.cpp.

◆ stop()

void Os::IntervalTimer::stop ( )

Capture the stop time of the interval.

This method records the current time as the stop time of the interval for this timer instance.

Examples
/home/runner/work/fprime/fprime/Os/IntervalTimer.hpp.

Definition at line 17 of file IntervalTimer.cpp.


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