16 int status = clock_gettime(CLOCK_REALTIME, &this->m_handle.
m_timespec);
28 if ((t1.tv_sec < t2.tv_sec) or (t1.tv_sec == t2.tv_sec and t1.tv_nsec < t2.tv_nsec)) {
34 U32 sec =
static_cast<U32
>(t1.tv_sec - t2.tv_sec);
36 if (t1.tv_nsec < t2.tv_nsec) {
38 nanosec =
static_cast<U32
>(t1.tv_nsec + (1000000000 - t2.tv_nsec));
40 nanosec =
static_cast<U32
>(t1.tv_nsec - t2.tv_nsec);
43 interval.
set(sec, nanosec / 1000);
49 "PosixRawTime implementation requires at least 2*sizeof(U32) serialization size");
59 "PosixRawTime implementation requires at least 2*sizeof(U32) serialization size");
70 this->m_handle.
m_timespec = {
static_cast<time_t
>(sec), static_cast<long>(nsec)};
75 return &this->m_handle;
Serialization/Deserialization operation was successful.
RawTime::Status errno_to_rawtime_status(int errno_input)
static const FwSizeType SERIALIZED_SIZE
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
Status getTimeInterval(const Os::RawTime &other, Fw::TimeInterval &interval) const override
Calculate the time interval between this and another raw time.
void set(U32 seconds, U32 useconds)
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) override
Deserialize the contents of the RawTimeInterface object from a buffer.
Status now() override
Get the current time.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const override
Serialize the contents of the RawTimeInterface object into a buffer.
RawTimeHandle * getHandle() override
return the underlying RawTime handle (implementation specific)