Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9e149b8

Browse files
committedMar 10, 2025
Replace unmaintained humantime crate with jiff
1 parent 340d123 commit 9e149b8

File tree

5 files changed

+35
-20
lines changed

5 files changed

+35
-20
lines changed
 

‎Cargo.lock

+28-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ hex = "0.4.3"
5555
hmac = "0.12.1"
5656
home = "0.5.11"
5757
http-auth = { version = "0.1.10", default-features = false }
58-
humantime = "2.1.0"
5958
ignore = "0.4.23"
6059
im-rc = "15.1.0"
6160
indexmap = "2.7.1"
6261
itertools = "0.14.0"
62+
jiff = { version = "0.2.3", default-features = false, features = [ "std" ] }
6363
jobserver = "0.1.32"
6464
lazycell = "1.3.0"
6565
libc = "0.2.169"
@@ -176,11 +176,11 @@ hex.workspace = true
176176
hmac.workspace = true
177177
home.workspace = true
178178
http-auth.workspace = true
179-
humantime.workspace = true
180179
ignore.workspace = true
181180
im-rc.workspace = true
182181
indexmap.workspace = true
183182
itertools.workspace = true
183+
jiff.workspace = true
184184
jobserver.workspace = true
185185
lazycell.workspace = true
186186
libgit2-sys.workspace = true

‎src/bin/cargo/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn setup_logger() -> Option<ChromeFlushGuard> {
7979
.with(fmt_layer)
8080
.with(profile_layer);
8181
registry.init();
82-
tracing::trace!(start = humantime::format_rfc3339(std::time::SystemTime::now()).to_string());
82+
tracing::trace!(start = jiff::Timestamp::now().to_string());
8383
profile_guard
8484
}
8585

‎src/cargo/core/compiler/fingerprint/dirty_reason.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ impl fmt::Display for FileTimeDiff {
102102
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
103103
let s_diff = self.new_time.seconds() - self.old_time.seconds();
104104
if s_diff >= 1 {
105-
fmt::Display::fmt(
106-
&humantime::Duration::from(std::time::Duration::from_secs(s_diff as u64)),
107-
f,
108-
)
105+
fmt::Display::fmt(&jiff::SignedDuration::from_secs(s_diff), f)
109106
} else {
110-
// format nanoseconds as it is, humantime would display ms, us and ns
107+
// format nanoseconds as it is, jiff would display ms, us and ns
111108
let ns_diff = self.new_time.nanoseconds() - self.old_time.nanoseconds();
112109
write!(f, "{ns_diff}ns")
113110
}

‎src/cargo/core/compiler/timings.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use cargo_util::paths;
1515
use std::collections::HashMap;
1616
use std::io::{BufWriter, Write};
1717
use std::thread::available_parallelism;
18-
use std::time::{Duration, Instant, SystemTime};
18+
use std::time::{Duration, Instant};
1919

2020
/// Tracking information for the entire build.
2121
///
@@ -117,7 +117,7 @@ impl<'gctx> Timings<'gctx> {
117117
(pkg_desc, targets)
118118
})
119119
.collect();
120-
let start_str = humantime::format_rfc3339_seconds(SystemTime::now()).to_string();
120+
let start_str = jiff::Timestamp::now().to_string();
121121
let profile = bcx.build_config.requested_profile.to_string();
122122
let last_cpu_state = if enabled {
123123
match State::current() {

0 commit comments

Comments
 (0)
Failed to load comments.