GCC Code Coverage Report


Directory: Os/
File: IntervalTimer.cpp
Date: 2026-09-03 21:15:10
Exec Total Coverage
Lines: 9 15 60.0%
Functions: 4 5 80.0%
Branches: 1 4 25.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title Os/IntervalTimer.cpp
3 // \brief Implementation for Os::IntervalTimer
4 // ======================================================================
5
6 #include <Os/IntervalTimer.hpp>
7 #include <cstring>
8
9 namespace Os {
10
11
1/1
✓ Branch 5 taken 1 times.
1 IntervalTimer::IntervalTimer() : m_startTime(), m_stopTime() {}
12
13 1 void IntervalTimer::start() {
14 1 (void)this->m_startTime.now();
15 1 }
16
17 1 void IntervalTimer::stop() {
18 1 (void)this->m_stopTime.now();
19 1 }
20
21 U32 IntervalTimer::getDiffUsec() const {
22 U32 result = 0;
23 Os::RawTime::Status status = this->m_stopTime.getDiffUsec(this->m_startTime, result);
24 if (status == Os::RawTime::Status::OP_OVERFLOW) {
25 // If the operation fails due to overflow, we return the max value
26 result = std::numeric_limits<U32>::max();
27 }
28 return result;
29 }
30
31 1 Os::RawTime::Status IntervalTimer::getTimeInterval(Fw::TimeInterval& interval) const {
32 1 return this->m_stopTime.getTimeInterval(this->m_startTime, interval);
33 }
34 } // namespace Os
35