F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
ChronoTime.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title ChronoTime.cpp
3// \author mstarch
4// \brief cpp file for ChronoTime component implementation class
5// ======================================================================
6
8#include <chrono>
9#include "FpConfig.hpp"
10
11namespace Svc {
12
13// ----------------------------------------------------------------------
14// Component construction and destruction
15// ----------------------------------------------------------------------
16
17ChronoTime ::ChronoTime(const char* const compName) : ChronoTimeComponentBase(compName) {}
18
19ChronoTime ::~ChronoTime() {}
20
21// ----------------------------------------------------------------------
22// Handler implementations for user-defined typed input ports
23// ----------------------------------------------------------------------
24
25void ChronoTime ::timeGetPort_handler(FwIndexType portNum, Fw::Time& time) {
26 const auto time_now = std::chrono::system_clock::now();
28 static_cast<U32>(std::chrono::duration_cast<std::chrono::seconds>(time_now.time_since_epoch()).count()),
29 static_cast<U32>(
30 std::chrono::duration_cast<std::chrono::microseconds>(time_now.time_since_epoch()).count() % 1000000));
31}
32
33} // namespace Svc
@ TB_WORKSTATION_TIME
Time as reported on workstation where software is running. For testing.
Definition FpConfig.h:72
PlatformIndexType FwIndexType
Definition FpConfig.h:25
C++-compatible configuration header for fprime configuration.
void set(U32 seconds, U32 useconds)
Definition Time.cpp:25
Auto-generated base for ChronoTime component.