F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
PosixTime.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 
12 namespace Svc {
13 
14  PosixTime::PosixTime(const char* name) : PosixTimeComponentBase(name)
15  {
16  }
17 
19  }
20 
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, static_cast<U32>(stime.tv_sec), static_cast<U32>(stime.tv_nsec/1000));
28  }
29 }
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
@ TB_WORKSTATION_TIME
Time as reported on workstation where software is running. For testing.
Definition: FpConfig.h:72
Definition: Time.hpp:9
void set(U32 seconds, U32 useconds)
Definition: Time.cpp:25
Auto-generated base for PosixTime component.
PosixTime(const char *compName)
Definition: PosixTime.cpp:14
virtual ~PosixTime()
Definition: PosixTime.cpp:18
void timeGetPort_handler(NATIVE_INT_TYPE portNum, Fw::Time &time)
Handler for input port timeGetPort.
Definition: PosixTime.cpp:21