GCC Code Coverage Report


Directory: ./
File: Svc/PosixTime/PosixTime.cpp
Date: 2026-09-03 22:12:29
Exec Total Coverage
Lines: 8 13 61.5%
Functions: 3 4 75.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 /*
2 * PosixTime.cpp
3 *
4 * Created on: Mar 28, 2014
5 * Author: tcanham
6 */
7
8 #include <Fw/Time/Time.hpp>
9 #include <Svc/PosixTime/PosixTime.hpp>
10 #include <ctime>
11
12 namespace Svc {
13
14 1 PosixTime::PosixTime(const char* name) : PosixTimeComponentBase(name), m_timeContext(0) {}
15
16 2 PosixTime::~PosixTime() {}
17
18 void PosixTime::setTimeContext(FwTimeContextStoreType timeContext) {
19 this->m_timeContext = timeContext;
20 }
21
22 3863 void PosixTime::timeGetPort_handler(FwIndexType portNum, /*!< The port number*/
23 Fw::Time& time /*!< The U32 cmd argument*/
24 ) {
25 3863 timespec stime = {};
26
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3864 times.
3863 if (clock_gettime(CLOCK_REALTIME, &stime) != 0) {
27 // report zero time rather than uninitialized garbage
28 stime.tv_sec = 0;
29 stime.tv_nsec = 0;
30 }
31
1/1
✓ Branch 1 taken 3864 times.
3864 time.set(TimeBase::TB_WORKSTATION_TIME, this->m_timeContext, static_cast<U32>(stime.tv_sec),
32
1/1
✓ Branch 1 taken 3864 times.
3864 static_cast<U32>(stime.tv_nsec / 1000));
33 3863 }
34 } // namespace Svc
35