12 FW_ASSERT(&this->m_delegate == reinterpret_cast<RawTimeInterface*>(&this->m_handle_storage[0]));
16 : m_delegate(*
RawTimeInterface::getDelegate(m_handle_storage, nullptr, source)), m_source(source) {
17 FW_ASSERT(&this->m_delegate == reinterpret_cast<RawTimeInterface*>(&this->m_handle_storage[0]));
21 FW_ASSERT(&this->m_delegate == reinterpret_cast<RawTimeInterface*>(&this->m_handle_storage[0]));
28 : m_delegate(*
RawTimeInterface::getDelegate(m_handle_storage, &other.m_delegate, other.m_source)),
29 m_source(other.m_source) {
30 FW_ASSERT(&this->m_delegate == reinterpret_cast<RawTimeInterface*>(&this->m_handle_storage[0]));
35 this->m_source = other.m_source;
42 FW_ASSERT(&this->m_delegate == reinterpret_cast<RawTimeInterface*>(&this->m_handle_storage[0]));
47 FW_ASSERT(&this->m_delegate == reinterpret_cast<RawTimeInterface*>(&this->m_handle_storage[0]));
48 return this->m_delegate.
now();
52 FW_ASSERT(&this->m_delegate == reinterpret_cast<const RawTimeInterface*>(&this->m_handle_storage[0]));
57 FW_ASSERT(&this->m_delegate == reinterpret_cast<const RawTimeInterface*>(&this->m_handle_storage[0]));
62 FW_ASSERT(&this->m_delegate == reinterpret_cast<const RawTimeInterface*>(&this->m_handle_storage[0]));
67 FW_ASSERT(&this->m_delegate == reinterpret_cast<const RawTimeInterface*>(&this->m_handle_storage[0]));
72 FW_ASSERT(&this->m_delegate == reinterpret_cast<const RawTimeInterface*>(&this->m_handle_storage[0]));
73 return this->m_delegate == other;
77 return this->m_source;
96 if (seconds > (std::numeric_limits<U32>::max() / 1000000)) {
97 result = std::numeric_limits<U32>::max();
98 return Status::OP_OVERFLOW;
100 U32 secToUsec = seconds * 1000000;
101 if (secToUsec > (std::numeric_limits<U32>::max() - useconds)) {
102 result = std::numeric_limits<U32>::max();
103 return Status::OP_OVERFLOW;
106 result = secToUsec + useconds;
RawTimeSource
Timer source selection for RawTime.
RawTimeHandle * getHandle() override
return the underlying RawTime handle (implementation specific)
RawTimeSource getSource() const
Get the timer source used by this RawTime instance.
virtual Status now()=0
Get the current time.
Status now() override
Get the current time.
virtual Status getDiffUsec(const RawTime &other, U32 &result) const
Calculate the difference in microseconds between two RawTime objects.
virtual ~RawTimeInterface()=default
default virtual destructor
SerializeStatus
forward declaration for string
virtual Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const =0
Serialize the contents of the RawTimeInterface object into a buffer.
virtual RawTimeHandle * getHandle()=0
return the underlying RawTime handle (implementation specific)
virtual bool operator==(const RawTime &other) const
Compare whether two RawTime objects are the same (i.e. refer to the same microsecond) ...
Status getTimeInterval(const Os::RawTime &other, Fw::TimeInterval &interval) const override
Calculate the time interval between this and another raw time.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) override
Deserialize the contents of the RawTimeInterface object from a buffer.
bool operator==(const RawTime &other) const override
Compare whether two RawTime objects are the same (i.e. refer to the same microsecond) ...
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const override
Serialize the contents of the RawTimeInterface object into a buffer.
Status getDiffUsec(const RawTime &other, U32 &result) const override
Calculate the difference in microseconds between two RawTime objects.
~DelegateRawTime() final
Destructor.
static RawTimeInterface * getDelegate(RawTimeHandleStorage &aligned_new_memory, const RawTimeInterface *to_copy=nullptr, RawTimeSource source=RAWTIME_DEFAULT)
provide a pointer to a RawTime delegate object
DelegateRawTime()
Default constructor.
virtual Status getTimeInterval(const Os::RawTime &other, Fw::TimeInterval &interval) const =0
Calculate the time interval between this and another raw time.
virtual Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)=0
Deserialize the contents of the RawTimeInterface object from a buffer.
DelegateRawTime & operator=(const DelegateRawTime &other)
assignment operator that copies the internal representation