F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
RawTime.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Posix/RawTime.hpp
3 // \brief Posix definitions for Os::RawTime
4 // ======================================================================
5 #ifndef OS_POSIX_RAWTIME_HPP
6 #define OS_POSIX_RAWTIME_HPP
7 
8 #include <Os/RawTime.hpp>
9 #include <ctime>
10 
11 namespace Os {
12 namespace Posix {
13 namespace RawTime {
14 
16  timespec m_timespec = {0, 0};
17  clockid_t m_clock_id = static_cast<clockid_t>(RAWTIME_DEFAULT);
18 };
19 
26  public:
28  PosixRawTime() = default;
29 
32  explicit PosixRawTime(RawTimeSource source);
33 
35  ~PosixRawTime() override = default;
36 
39  RawTimeHandle* getHandle() override;
40 
41  // ------------------------------------------------------------
42  // Implementation-specific RawTime overrides
43  // ------------------------------------------------------------
50  Status now() override;
51 
60  Status getTimeInterval(const Os::RawTime& other, Fw::TimeInterval& interval) const override;
61 
76  Fw::Endianness mode = Fw::Endianness::BIG) const override;
77 
92  Fw::Endianness mode = Fw::Endianness::BIG) override;
93 
94  private:
96  PosixRawTimeHandle m_handle;
97 };
98 
99 } // namespace RawTime
100 } // namespace Posix
101 } // namespace Os
102 #endif // OS_POSIX_RAWTIME_HPP
clockid_t m_clock_id
Clock read by now()
Definition: RawTime.hpp:17
PosixRawTime()=default
constructor using RAWTIME_DEFAULT as the clock source
Status getTimeInterval(const Os::RawTime &other, Fw::TimeInterval &interval) const override
Calculate the time interval between this and another raw time.
Definition: RawTime.cpp:27
SerializeStatus
forward declaration for string
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) override
Deserialize the contents of the RawTimeInterface object from a buffer.
Definition: RawTime.cpp:69
~PosixRawTime() override=default
destructor
RawTimeSource
Timer source selection for RawTime.
Status now() override
Get the current time.
Definition: RawTime.cpp:19
Platform&#39;s default timer.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const override
Serialize the contents of the RawTimeInterface object into a buffer.
Definition: RawTime.cpp:59
DelegateRawTime RawTime
RawTimeHandle * getHandle() override
return the underlying RawTime handle (implementation specific)
Definition: RawTime.cpp:86
Posix implementation of Os::RawTime.
Definition: RawTime.hpp:25
Endianness
Big endian serialization.