fprime/Svc/LinuxTime/LinuxTimeImpl.cpp
Joshua Anderson 3cccd731d9
Refactor FW_OBJECT_NAMES switches and fix building without object names
Instead of adding the name argument to a constructor when FW_OBJECT_NAMES
is enabled, always supply a name argument.

Add a marco that conditionally sets the name to "" if FW_OBJECT_NAMES is not set.
This cleans up a lot of the conditional compilation switches that weren't being tested
and would silently break, while still stripping the strings from the binary.
2020-10-07 17:19:05 -07:00

35 lines
769 B
C++

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