SatCat5
satcat5::datetime::RtcTime Struct Reference

Detailed Description

Hardware RTC (e.g., Renesas ISL12082).

This format mimics the eight-byte timestamp used by many real-time clock ASICs, such as the Renesas ISL12082. The resolution of this format is limited to 10-millisecond steps.

For hardware compatibitilty, the Over-the-wire format used in write_to and read_from is BCD-coded. For local use, the in-memory format uses normal binary values.

Note: HR field will always be in 24-hour "military" format.

Definition at line 109 of file datetime.h.

#include <datetime.h>

Public Member Functions

 RtcTime (const RtcTime &t)=default
 
RtcTimeoperator= (const RtcTime &t)=default
 
s64 convert () const
 Convert to standard form. More...
 
u32 days_since_epoch () const
 Days since 2000 Jan 1 (a Saturday).
 
u32 msec_since_midnight () const
 Milliseconds since midnight (0 - 86.4M).
 
bool validate () const
 Are current contents valid?
 
bool operator== (const satcat5::datetime::RtcTime &other) const
 
bool operator< (const satcat5::datetime::RtcTime &other) const
 
void write_to (satcat5::io::Writeable *wr) const
 Write legacy binary format (Deprecated). More...
 
bool read_from (satcat5::io::Readable *rd)
 Read legacy binary format (Deprecated). More...
 
void log_to (satcat5::log::LogBuffer &wr) const
 Format as an ISO8601 / RFC3339 timestamp. More...
 

Public Attributes

u8 dw
 Day of week (0-6, 0 = Sunday)
 
u8 ct
 Century (20 = year 20xx)
 
u8 yr
 Year (00-99)
 
u8 mo
 Month (1-12)
 
u8 dt
 Day-of-month (1-31)
 
u8 hr
 Hour (0-23) + MIL bit. More...
 
u8 mn
 Minutes (0-59)
 
u8 sc
 Seconds (0-59)
 
u8 ss
 Sub-seconds (0-99)
 

Member Function Documentation

◆ convert()

s64 satcat5::datetime::RtcTime::convert ( ) const
inline

Convert to standard form.

See also
from_rtc.

Definition at line 125 of file datetime.h.

◆ log_to()

void RtcTime::log_to ( satcat5::log::LogBuffer wr) const

Format as an ISO8601 / RFC3339 timestamp.

ISO doesn't allow a "GPS" time-zone, so we use UTC instead. For better accuracy, add the current leap-second offset before converting the GPS timestamp to the RTC format.

Definition at line 315 of file datetime.cc.

◆ read_from()

bool RtcTime::read_from ( satcat5::io::Readable rd)

Read legacy binary format (Deprecated).

Note: Legacy format does not support years beyond 2099.

Definition at line 290 of file datetime.cc.

◆ write_to()

void RtcTime::write_to ( satcat5::io::Writeable wr) const

Write legacy binary format (Deprecated).

Note: Legacy format does not support years beyond 2099.

Definition at line 275 of file datetime.cc.

Member Data Documentation

◆ hr

u8 satcat5::datetime::RtcTime::hr

Hour (0-23) + MIL bit.

See also
RTC_MIL_BIT

Definition at line 115 of file datetime.h.


The documentation for this struct was generated from the following files: