Skip to content

Commit 82fe82a

Browse files
Merge #1801
1801: fix microsecond calculation for TimeSpec r=rtzoeller a=StephanvanSchaik The implementation of `num_microseconds()` for `TimeSpec` returns the number of seconds not microseconds, as it divided by the wrong factor. The number of nanoseconds should be divided by 1000 to get the number of microseconds. Co-authored-by: S.J.R. van Schaik <stephan@synkhronix.com>
2 parents 2a8b438 + 7109eb9 commit 82fe82a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1313

1414
### Fixed
1515

16+
- Fix microsecond calculation for `TimeSpec`.
17+
([#1801](https://github.com/nix-rust/nix/pull/1801))
18+
1619
### Removed
1720

1821
## [0.25.0] - 2022-08-13

src/sys/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl TimeValLike for TimeSpec {
319319
}
320320

321321
fn num_microseconds(&self) -> i64 {
322-
self.num_nanoseconds() / 1_000_000_000
322+
self.num_nanoseconds() / 1_000
323323
}
324324

325325
fn num_nanoseconds(&self) -> i64 {

0 commit comments

Comments
 (0)