changelog should be complete
This commit is contained in:
parent
708b68a5cb
commit
c8d442690b
26
CHANGELOG.md
26
CHANGELOG.md
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
- New `UnixTimestamp` abstraction which contains the unix seconds as an `i64`
|
- New `UnixTimestamp` abstraction which contains the unix seconds as an `i64`
|
||||||
and an optional subsecond millisecond counter (`u16`)
|
and an optional subsecond millisecond counter (`u16`)
|
||||||
|
- `MS_PER_DAY` constant.
|
||||||
|
|
||||||
### CDS time module
|
### CDS time module
|
||||||
|
|
||||||
@ -20,22 +21,35 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
and subsecond milliseconds).
|
and subsecond milliseconds).
|
||||||
- `MAX_DAYS_24_BITS` which contains maximum value which can be supplied
|
- `MAX_DAYS_24_BITS` which contains maximum value which can be supplied
|
||||||
to the days field of a CDS time provider with 24 bits days field width.
|
to the days field of a CDS time provider with 24 bits days field width.
|
||||||
- New `CdsTimestamp` trait which encapsulates common fields for all CDS time providers
|
- New `CdsTimestamp` trait which encapsulates common fields for all CDS time providers.
|
||||||
- `get_dyn_time_provider_from_bytes`: Requires `alloc` support and returns
|
- `get_dyn_time_provider_from_bytes`: Requires `alloc` support and returns
|
||||||
the correct `TimeProvider` instance wrapped as a boxed trait object
|
the correct `TimeProvider` instance wrapped as a boxed trait object
|
||||||
`Box<DynCdsTimeProvider>` by checking the length of days field.
|
`Box<DynCdsTimeProvider>` by checking the length of days field.
|
||||||
- `from_unix_secs_with_u24_days` and `from_unix_secs_with_u16_days`
|
- `from_unix_secs_with_u24_days` and `from_unix_secs_with_u16_days` which create
|
||||||
|
the time provider from a `UnixTimestamp` reference.
|
||||||
|
- `from_dt_with_u16_days`, `from_dt_with_u24_days` and their `..._us_precision` and
|
||||||
|
`..._ps_precision` variants which allow to create time providers from
|
||||||
|
a `chrono::DateTime<Utc>`.
|
||||||
|
- Add `from_bytes_with_u24_days` and `from_bytes_with_u16_days` associated methods
|
||||||
|
- Implement `Add<Duration>` and `AddAssign<Duration>` for time providers, which allows
|
||||||
|
easily adding offsets to the providers.
|
||||||
|
- Implement `TryFrom<DateTime<Utc>>` for time providers.
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
- (breaking): Renamed `from_now_with_u24_days_and_us_prec` to `from_now_with_u24_days_us_precision`.
|
||||||
|
Also did the same for the `u16` variant.
|
||||||
|
- (breaking): Renamed `from_now_with_u24_days_and_ps_prec` to `from_now_with_u24_days_ps_precision`.
|
||||||
|
Also did the same for the `u16` variant.
|
||||||
- `CcsdsTimeProvider` trait (breaking):
|
- `CcsdsTimeProvider` trait (breaking):
|
||||||
- Add new `unix_stamp` method returning the new `UnixTimeStamp` struct
|
- Add new `unix_stamp` method returning the new `UnixTimeStamp` struct.
|
||||||
- Add new `subsecond_millis` method returning counter `Option<u16>`
|
- Add new `subsecond_millis` method returning counter `Option<u16>`.
|
||||||
- Default impl for `unix_stamp` which re-uses `subsecond_millis` and
|
- Default impl for `unix_stamp` which re-uses `subsecond_millis` and
|
||||||
existing `unix_seconds` method
|
existing `unix_seconds` method.
|
||||||
- `TimestampError` (breaking): Add `DateBeforeCcsdsEpoch` error type
|
- `TimestampError` (breaking): Add `DateBeforeCcsdsEpoch` error type
|
||||||
because new CDS API allow supplying invalid date times before CCSDS epoch.
|
because new CDS API allow supplying invalid date times before CCSDS epoch.
|
||||||
Make `TimestampError` with `#[non_exhaustive]` attribute to prevent
|
Make `TimestampError` with `#[non_exhaustive]` attribute to prevent
|
||||||
future breakages if new error variants are added
|
future breakages if new error variants are added.
|
||||||
|
|
||||||
# [v0.4.2] 14.01.2023
|
# [v0.4.2] 14.01.2023
|
||||||
|
|
||||||
|
@ -292,6 +292,13 @@ impl UnixTimestamp {
|
|||||||
}
|
}
|
||||||
secs
|
secs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn as_date_time(&self) -> LocalResult<DateTime<Utc>> {
|
||||||
|
Utc.timestamp_opt(
|
||||||
|
self.unix_seconds,
|
||||||
|
self.subsecond_millis.unwrap_or(0) as u32 * 10_u32.pow(6),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DateTime<Utc>> for UnixTimestamp {
|
impl From<DateTime<Utc>> for UnixTimestamp {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user