Skip to content

Commit

Permalink
fix: fixed timestamp parsing in case of negative value and zero fract…
Browse files Browse the repository at this point in the history
…ional part
  • Loading branch information
pamburus committed Mar 20, 2024
1 parent 80b5e5f commit 514fa65
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["command-line-utilities"]
description = "Utility for viewing json-formatted log files."
keywords = ["cli", "human", "log"]
name = "hl"
version = "0.27.0-beta.3"
version = "0.27.0-beta.3.1"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> Timestamp<'a> {
match whole {
Self::TS_UNIX_AUTO_S_MIN..=Self::TS_UNIX_AUTO_S_MAX => {
let ns = (fractional * 1e9).round() as u32;
let (whole, ns) = if whole < 0 {
let (whole, ns) = if whole < 0 && ns > 0 {
(whole - 1, 1_000_000_000 - ns)
} else {
(whole, ns)
Expand Down

0 comments on commit 514fa65

Please sign in to comment.