F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinuxTimeImpl.cpp
Go to the documentation of this file.
1/*
2 * TestCommand1Impl.cpp
3 *
4 * Created on: Mar 28, 2014
5 * Author: tcanham
6 */
7
9#include <Fw/Time/Time.hpp>
10#include <ctime>
11
12namespace Svc {
13
14 LinuxTimeImpl::LinuxTimeImpl(const char* name) : TimeComponentBase(name)
15 {
16 }
17
18 LinuxTimeImpl::~LinuxTimeImpl() {
19 }
20
21 void LinuxTimeImpl::timeGetPort_handler(
22 NATIVE_INT_TYPE portNum,
23 Fw::Time &time
24 ) {
25 timespec stime;
26 (void)clock_gettime(CLOCK_REALTIME,&stime);
27 time.set(TB_WORKSTATION_TIME,0, stime.tv_sec, stime.tv_nsec/1000);
28 }
29
30 void LinuxTimeImpl::init(NATIVE_INT_TYPE instance) {
31 TimeComponentBase::init(instance);
32 }
33
34}
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
@ TB_WORKSTATION_TIME
Time as reported on workstation where software is running. For testing.
Definition FpConfig.h:41
void set(U32 seconds, U32 useconds)
Definition Time.cpp:25
LinuxTimeImpl(const char *compName)