use ISO8601 format in docs
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-01-22 13:18:51 +01:00
parent f634a57f93
commit f54cf69d87
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 15 additions and 15 deletions

View File

@ -790,19 +790,19 @@ impl TimeProvider<DaysLen24Bits> {
/// ## Errors /// ## Errors
/// ///
/// This function will return [TimestampError::DateBeforeCcsdsEpoch] or /// This function will return [TimestampError::DateBeforeCcsdsEpoch] or
/// [TimestampError::CdsError] if the time is before the CCSDS epoch (01-01-1958 00:00:00) or /// [TimestampError::CdsError] if the time is before the CCSDS epoch (1958-01-01T00:00:00+00:00)
/// the CCSDS days value exceeds the allowed bit width (24 bits). /// or the CCSDS days value exceeds the allowed bit width (24 bits).
pub fn from_dt_with_u24_days(dt: &DateTime<Utc>) -> Result<Self, TimestampError> { pub fn from_dt_with_u24_days(dt: &DateTime<Utc>) -> Result<Self, TimestampError> {
Self::from_dt_generic(dt, LengthOfDaySegment::Long24Bits) Self::from_dt_generic(dt, LengthOfDaySegment::Long24Bits)
} }
/// Create a provider from a generic UNIX timestamp (seconds since 01-01-1970 00:00:00). /// Create a provider from a generic UNIX timestamp (seconds since 1970-01-01T00:00:00+00:00).
/// ///
/// ## Errors /// ## Errors
/// ///
/// This function will return [TimestampError::DateBeforeCcsdsEpoch] or /// This function will return [TimestampError::DateBeforeCcsdsEpoch] or
/// [TimestampError::CdsError] if the time is before the CCSDS epoch (01-01-1958 00:00:00) or /// [TimestampError::CdsError] if the time is before the CCSDS epoch (1958-01-01T00:00:00+00:00)
/// the CCSDS days value exceeds the allowed bit width (24 bits). /// or the CCSDS days value exceeds the allowed bit width (24 bits).
pub fn from_unix_secs_with_u24_days( pub fn from_unix_secs_with_u24_days(
unix_stamp: &UnixTimestamp, unix_stamp: &UnixTimestamp,
) -> Result<Self, TimestampError> { ) -> Result<Self, TimestampError> {
@ -879,13 +879,13 @@ impl TimeProvider<DaysLen16Bits> {
Self::from_now_generic(LengthOfDaySegment::Short16Bits) Self::from_now_generic(LengthOfDaySegment::Short16Bits)
} }
/// Create a provider from a generic UNIX timestamp (seconds since 01-01-1970 00:00:00). /// Create a provider from a generic UNIX timestamp (seconds since 1970-01-01T00:00:00+00:00).
/// ///
/// ## Errors /// ## Errors
/// ///
/// This function will return [TimestampError::DateBeforeCcsdsEpoch] or /// This function will return [TimestampError::DateBeforeCcsdsEpoch] or
/// [TimestampError::CdsError] if the time is before the CCSDS epoch (01-01-1958 00:00:00) or /// [TimestampError::CdsError] if the time is before the CCSDS epoch (1958-01-01T00:00:00+00:00)
/// the CCSDS days value exceeds the allowed bit width (24 bits). /// or the CCSDS days value exceeds the allowed bit width (24 bits).
pub fn from_unix_secs_with_u16_days( pub fn from_unix_secs_with_u16_days(
unix_stamp: &UnixTimestamp, unix_stamp: &UnixTimestamp,
) -> Result<Self, TimestampError> { ) -> Result<Self, TimestampError> {

View File

@ -134,8 +134,8 @@ pub struct FractionalPart(FractionalResolution, u32);
/// It has the capability to generate and read timestamps as specified in the CCSDS 301.0-B-4 /// It has the capability to generate and read timestamps as specified in the CCSDS 301.0-B-4
/// section 3.2 . The preamble field only has one byte, which allows a time code representation /// section 3.2 . The preamble field only has one byte, which allows a time code representation
/// through the year 2094. The time is represented as a simple binary counter starting from the /// through the year 2094. The time is represented as a simple binary counter starting from the
/// fixed CCSDS epoch (1958-01-01 00:00:00). It is possible to provide subsecond accuracy using the /// fixed CCSDS epoch (1958-01-01T00:00:00+00:00). It is possible to provide subsecond accuracy
/// fractional field with various available [resolutions][FractionalResolution]. /// using the fractional field with various available [resolutions][FractionalResolution].
/// ///
/// Having a preamble field of one byte limits the width of the counter /// Having a preamble field of one byte limits the width of the counter
/// type (generally seconds) to 4 bytes and the width of the fractions type to 3 bytes. This limits /// type (generally seconds) to 4 bytes and the width of the fractions type to 3 bytes. This limits

View File

@ -157,16 +157,16 @@ pub fn seconds_since_epoch() -> f64 {
/// Convert UNIX days to CCSDS days /// Convert UNIX days to CCSDS days
/// ///
/// - CCSDS epoch: 1958 January 1 /// - CCSDS epoch: 1958-01-01T00:00:00+00:00
/// - UNIX Epoch: 1970 January 1 /// - UNIX Epoch: 1970-01-01T00:00:00+00:00
pub const fn unix_to_ccsds_days(unix_days: i64) -> i64 { pub const fn unix_to_ccsds_days(unix_days: i64) -> i64 {
unix_days - DAYS_CCSDS_TO_UNIX as i64 unix_days - DAYS_CCSDS_TO_UNIX as i64
} }
/// Convert CCSDS days to UNIX days /// Convert CCSDS days to UNIX days
/// ///
/// - CCSDS epoch: 1958 January 1 /// - CCSDS epoch: 1958-01-01T00:00:00+00:00
/// - UNIX Epoch: 1970 January 1 /// - UNIX Epoch: 1970-01-01T00:00:00+00:00
pub const fn ccsds_to_unix_days(ccsds_days: i64) -> i64 { pub const fn ccsds_to_unix_days(ccsds_days: i64) -> i64 {
ccsds_days + DAYS_CCSDS_TO_UNIX as i64 ccsds_days + DAYS_CCSDS_TO_UNIX as i64
} }
@ -233,7 +233,7 @@ pub trait CcsdsTimeProvider {
fn date_time(&self) -> Option<DateTime<Utc>>; fn date_time(&self) -> Option<DateTime<Utc>>;
} }
/// UNIX timestamp: Elapsed seconds since 01-01-1970 00:00:00. /// UNIX timestamp: Elapsed seconds since 1970-01-01T00:00:00+00:00.
/// ///
/// Also can optionally include subsecond millisecond for greater accuracy. Please note that a /// Also can optionally include subsecond millisecond for greater accuracy. Please note that a
/// subsecond millisecond value of 0 gets converted to [None]. /// subsecond millisecond value of 0 gets converted to [None].