From f54cf69d8723150ad1dcb2ac227ad502f2f5166d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 22 Jan 2023 13:18:51 +0100 Subject: [PATCH] use ISO8601 format in docs --- src/time/cds.rs | 16 ++++++++-------- src/time/cuc.rs | 4 ++-- src/time/mod.rs | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/time/cds.rs b/src/time/cds.rs index 218e854..6fb0e2c 100644 --- a/src/time/cds.rs +++ b/src/time/cds.rs @@ -790,19 +790,19 @@ impl TimeProvider { /// ## Errors /// /// This function will return [TimestampError::DateBeforeCcsdsEpoch] or - /// [TimestampError::CdsError] if the time is before the CCSDS epoch (01-01-1958 00:00:00) or - /// the CCSDS days value exceeds the allowed bit width (24 bits). + /// [TimestampError::CdsError] if the time is before the CCSDS epoch (1958-01-01T00:00:00+00:00) + /// or the CCSDS days value exceeds the allowed bit width (24 bits). pub fn from_dt_with_u24_days(dt: &DateTime) -> Result { 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 /// /// This function will return [TimestampError::DateBeforeCcsdsEpoch] or - /// [TimestampError::CdsError] if the time is before the CCSDS epoch (01-01-1958 00:00:00) or - /// the CCSDS days value exceeds the allowed bit width (24 bits). + /// [TimestampError::CdsError] if the time is before the CCSDS epoch (1958-01-01T00:00:00+00:00) + /// or the CCSDS days value exceeds the allowed bit width (24 bits). pub fn from_unix_secs_with_u24_days( unix_stamp: &UnixTimestamp, ) -> Result { @@ -879,13 +879,13 @@ impl TimeProvider { 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 /// /// This function will return [TimestampError::DateBeforeCcsdsEpoch] or - /// [TimestampError::CdsError] if the time is before the CCSDS epoch (01-01-1958 00:00:00) or - /// the CCSDS days value exceeds the allowed bit width (24 bits). + /// [TimestampError::CdsError] if the time is before the CCSDS epoch (1958-01-01T00:00:00+00:00) + /// or the CCSDS days value exceeds the allowed bit width (24 bits). pub fn from_unix_secs_with_u16_days( unix_stamp: &UnixTimestamp, ) -> Result { diff --git a/src/time/cuc.rs b/src/time/cuc.rs index 799769c..9790afb 100644 --- a/src/time/cuc.rs +++ b/src/time/cuc.rs @@ -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 /// 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 -/// fixed CCSDS epoch (1958-01-01 00:00:00). It is possible to provide subsecond accuracy using the -/// fractional field with various available [resolutions][FractionalResolution]. +/// fixed CCSDS epoch (1958-01-01T00:00:00+00:00). It is possible to provide subsecond accuracy +/// using the fractional field with various available [resolutions][FractionalResolution]. /// /// 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 diff --git a/src/time/mod.rs b/src/time/mod.rs index 9b9d246..57081b2 100644 --- a/src/time/mod.rs +++ b/src/time/mod.rs @@ -157,16 +157,16 @@ pub fn seconds_since_epoch() -> f64 { /// Convert UNIX days to CCSDS days /// -/// - CCSDS epoch: 1958 January 1 -/// - UNIX Epoch: 1970 January 1 +/// - CCSDS epoch: 1958-01-01T00:00:00+00:00 +/// - UNIX Epoch: 1970-01-01T00:00:00+00:00 pub const fn unix_to_ccsds_days(unix_days: i64) -> i64 { unix_days - DAYS_CCSDS_TO_UNIX as i64 } /// Convert CCSDS days to UNIX days /// -/// - CCSDS epoch: 1958 January 1 -/// - UNIX Epoch: 1970 January 1 +/// - CCSDS epoch: 1958-01-01T00:00:00+00:00 +/// - UNIX Epoch: 1970-01-01T00:00:00+00:00 pub const fn ccsds_to_unix_days(ccsds_days: i64) -> i64 { ccsds_days + DAYS_CCSDS_TO_UNIX as i64 } @@ -233,7 +233,7 @@ pub trait CcsdsTimeProvider { fn date_time(&self) -> Option>; } -/// 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 /// subsecond millisecond value of 0 gets converted to [None].