Skip to content

Commit 1e979e8

Browse files
committed
use jiff instead of chrono
1 parent 12f6343 commit 1e979e8

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed

Cargo.lock

Lines changed: 57 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbo-persistence/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ print_stats = ["stats"]
1414
anyhow = { workspace = true }
1515
pot = "3.0.0"
1616
byteorder = "1.5.0"
17-
chrono = "0.4.40"
17+
jiff = "0.2.10"
1818
lzzzz = "1.1.0"
1919
memmap2 = "0.9.5"
2020
parking_lot = { workspace = true }

turbopack/crates/turbo-persistence/src/db.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ use std::{
99
atomic::{AtomicBool, AtomicU32, Ordering},
1010
Arc,
1111
},
12-
time::Instant,
1312
};
1413

1514
use anyhow::{bail, Context, Result};
1615
use byteorder::{ReadBytesExt, WriteBytesExt, BE};
17-
use chrono::Local;
16+
use jiff::Timestamp;
1817
use lzzzz::lz4::decompress;
1918
use memmap2::Mmap;
2019
use parking_lot::{Mutex, RwLock};
@@ -436,8 +435,7 @@ impl TurboPersistence {
436435
mut indicies_to_delete: Vec<usize>,
437436
mut seq: u32,
438437
) -> Result<(), anyhow::Error> {
439-
let time = Local::now();
440-
let start = Instant::now();
438+
let time = Timestamp::now();
441439

442440
new_sst_files.sort_unstable_by_key(|(seq, _)| *seq);
443441

@@ -508,8 +506,9 @@ impl TurboPersistence {
508506

509507
{
510508
let mut log = self.open_log()?;
511-
writeln!(log, "Time {}", time.format("%Y-%m-%d %H:%M"))?;
512-
writeln!(log, "Commit {seq:08} {:?}", start.elapsed())?;
509+
writeln!(log, "Time {}", time)?;
510+
let span = time.until(Timestamp::now())?;
511+
writeln!(log, "Commit {seq:08} {:#}", span)?;
513512
for (index, family, min, max, size) in new_sst_info.iter() {
514513
writeln!(
515514
log,

0 commit comments

Comments
 (0)