From aa5c206c1c65f37ff8eea3938f6b104957d54787 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 14 Jan 2023 17:46:43 +0100 Subject: [PATCH 1/3] another small bugfix --- CHANGELOG.md | 7 +++++++ Cargo.toml | 2 +- src/time/cds.rs | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 649bfa1..e0c4ea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +# [v0.4.2] 14.01.2023 + +## Fixed + +- CDS timestamp: Fixed another small logic error for stamp creation from the current + time with picosecond precision. + # [v0.4.1] 14.01.2023 ## Fixed diff --git a/Cargo.toml b/Cargo.toml index 8c34852..615cc77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spacepackets" -version = "0.4.1" +version = "0.4.2" edition = "2021" rust-version = "1.60" authors = ["Robin Mueller "] diff --git a/src/time/cds.rs b/src/time/cds.rs index 399b820..fb8cc65 100644 --- a/src/time/cds.rs +++ b/src/time/cds.rs @@ -170,7 +170,7 @@ impl ConversionFromNow { )); } SubmillisPrecision::Picoseconds(_) => { - prec = Some(SubmillisPrecision::Picoseconds(now.subsec_nanos() * 1000)); + prec = Some(SubmillisPrecision::Picoseconds((now.subsec_nanos() % 10_u32.pow(6)) * 1000)); } _ => (), } -- 2.34.1 From ef5a4e292445049fb45c8011ddddc0ddff049fb0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 14 Jan 2023 17:46:58 +0100 Subject: [PATCH 2/3] cargo fmt --- src/time/cds.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/time/cds.rs b/src/time/cds.rs index fb8cc65..e600fbb 100644 --- a/src/time/cds.rs +++ b/src/time/cds.rs @@ -170,7 +170,9 @@ impl ConversionFromNow { )); } SubmillisPrecision::Picoseconds(_) => { - prec = Some(SubmillisPrecision::Picoseconds((now.subsec_nanos() % 10_u32.pow(6)) * 1000)); + prec = Some(SubmillisPrecision::Picoseconds( + (now.subsec_nanos() % 10_u32.pow(6)) * 1000, + )); } _ => (), } -- 2.34.1 From 6e593e4e277e7fe405f5b708aef3957d754698a1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 14 Jan 2023 17:47:52 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0c4ea6..9eff220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - CDS timestamp: Fixed another small logic error for stamp creation from the current time with picosecond precision. + PR: https://egit.irs.uni-stuttgart.de/rust/spacepackets/pulls/8 # [v0.4.1] 14.01.2023 @@ -22,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - CDS timestamp: The conversion function from the current time were buggy when specifying picoseconds precision, which could lead to overflow multiplications and/or incorrect precision fields. + PR: https://egit.irs.uni-stuttgart.de/rust/spacepackets/pulls/7 # [v0.4.0] 10.01.2023 -- 2.34.1