diff --git a/CHANGELOG.md b/CHANGELOG.md index e496dff..7bc2f8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [1.1.6] 2021-01-30 ### Changed - remove `rand` crate dependency in favor of more lightweight `fastrand` crate - little change of time unit presentation, to be more human readable for slow systems like my Raspi @@ -26,7 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.1.1] 2020-05-12 ## [1.0.0] 2020-05-07 -[Unreleased]: https://github.com/sassman/ssd-benchmark-rs/compare/v1.1.5...HEAD +[Unreleased]: https://github.com/sassman/ssd-benchmark-rs/compare/v1.1.6...HEAD +[1.1.6]: https://github.com/sassman/ssd-benchmark-rs/compare/v1.1.6...v1.1.5 [1.1.5]: https://github.com/sassman/ssd-benchmark-rs/compare/v1.1.5...v1.1.4 [1.1.4]: https://github.com/sassman/ssd-benchmark-rs/compare/v1.1.4...v1.1.3 [1.1.3]: https://github.com/sassman/ssd-benchmark-rs/compare/v1.1.3...v1.1.4 diff --git a/Cargo.lock b/Cargo.lock index 7eb152f..787adfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,7 +32,7 @@ dependencies = [ [[package]] name = "ssd-benchmark" -version = "1.1.5" +version = "1.1.6" dependencies = [ "fastrand", "figlet-rs", diff --git a/Cargo.toml b/Cargo.toml index 5c3aac0..abafb5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ssd-benchmark" description = "Super Simple Disk Benchmark - benchmarks the writing performance of your disk." -version = "1.1.5" +version = "1.1.6" authors = ["Sven Assmann "] edition = "2018" license = "GPL-3.0-only" diff --git a/src/utils.rs b/src/utils.rs index 0fcfa44..46d14f6 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -20,13 +20,13 @@ impl HumanReadable for Duration { if self >= &ONE_MIN { let time = (self.as_secs() / 60) as u128; let seconds = self.as_secs() - (time * 60) as u64; - return format!("{} m {} {:<4}", time, seconds, "s"); + return format!("{} m {} {:<3}", time, seconds, "s"); } else if self >= &ONE_SEC { return format!("{:>10} {:<4}", self.as_secs_f32().round(), "s"); } let time = self.as_millis(); - format!("{:>10} ms", time) + format!("{:>10} {:<4}", time, "ms") } } @@ -119,10 +119,19 @@ mod tests { #[test] fn should_format_time() { - assert_eq!(Duration::from_secs(100).as_human_readable(), "1m 40s"); - assert_eq!(Duration::from_millis(1200).as_human_readable(), "~1s"); - assert_eq!(Duration::from_millis(1800).as_human_readable(), "~2s"); - assert_eq!(Duration::from_millis(100).as_human_readable(), "100ms"); + assert_eq!(Duration::from_secs(100).as_human_readable(), "1 m 40 s "); + assert_eq!( + Duration::from_millis(1200).as_human_readable(), + " 1 s " + ); + assert_eq!( + Duration::from_millis(1800).as_human_readable(), + " 2 s " + ); + assert_eq!( + Duration::from_millis(100).as_human_readable(), + " 100 ms " + ); } #[test]