fprime/Svc/PosixTime/PosixTime.cpp
Thomas Boyer-Chammard c69ff72110
Format Svc and add to CI (#3978)
* Format Svc and add to CI

* Fix comlogger include

* fix assert UTs

* Fix static analysis warning

* formatting
2025-08-04 16:21:47 -07:00

26 lines
672 B
C++

/*
* TestCommand1Impl.cpp
*
* Created on: Mar 28, 2014
* Author: tcanham
*/
#include <Fw/Time/Time.hpp>
#include <Svc/PosixTime/PosixTime.hpp>
#include <ctime>
namespace Svc {
PosixTime::PosixTime(const char* name) : PosixTimeComponentBase(name) {}
PosixTime::~PosixTime() {}
void PosixTime::timeGetPort_handler(FwIndexType portNum, /*!< The port number*/
Fw::Time& time /*!< The U32 cmd argument*/
) {
timespec stime;
(void)clock_gettime(CLOCK_REALTIME, &stime);
time.set(TimeBase::TB_WORKSTATION_TIME, 0, static_cast<U32>(stime.tv_sec), static_cast<U32>(stime.tv_nsec / 1000));
}
} // namespace Svc