GCC Code Coverage Report


Directory: Svc/ChronoTime/
File: ChronoTime.cpp
Date: 2026-09-03 21:16:42
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 3 3 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title ChronoTime.cpp
3 // \author mstarch
4 // \brief cpp file for ChronoTime component implementation class
5 // ======================================================================
6
7 #include "Svc/ChronoTime/ChronoTime.hpp"
8 #include <chrono>
9 #include "Fw/FPrimeBasicTypes.hpp"
10
11 namespace Svc {
12
13 // ----------------------------------------------------------------------
14 // Component construction and destruction
15 // ----------------------------------------------------------------------
16
17 1 ChronoTime ::ChronoTime(const char* const compName) : ChronoTimeComponentBase(compName) {}
18
19 2 ChronoTime ::~ChronoTime() {}
20
21 // ----------------------------------------------------------------------
22 // Handler implementations for user-defined typed input ports
23 // ----------------------------------------------------------------------
24
25 1 void ChronoTime ::timeGetPort_handler(FwIndexType portNum, Fw::Time& time) {
26 1 const auto time_now = std::chrono::system_clock::now();
27
2/2
✓ Branch 5 taken 1 times.
✓ Branch 8 taken 1 times.
2 time.set(TimeBase::TB_WORKSTATION_TIME,
28
1/1
✓ Branch 4 taken 1 times.
2 static_cast<U32>(std::chrono::duration_cast<std::chrono::seconds>(time_now.time_since_epoch()).count()),
29 static_cast<U32>(
30
1/1
✓ Branch 5 taken 1 times.
2 std::chrono::duration_cast<std::chrono::microseconds>(time_now.time_since_epoch()).count() % 1000000));
31 1 }
32
33 } // namespace Svc
34