Skip to content

Commit

Permalink
feat: use rfc339 in Timestamp::standard_format()
Browse files Browse the repository at this point in the history
This causes timestamps to display as:

  2024-05-03T07:40:52.287-07:00

instead of:

  Thu, 2 May 2024 12:05:43 -0700

The new style includes sub-second precision, omitting trailing zeros
which is very useful for logfiles.
  • Loading branch information
dan-da committed May 3, 2024
1 parent c94a02b commit 5a8ad63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/models/consensus/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Timestamp {
NaiveDateTime::from_timestamp_millis(self.0.value().try_into().unwrap_or(0)).unwrap();
let utc: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive, *Utc::now().offset());
let offset: DateTime<Local> = DateTime::from(utc);
offset.to_rfc2822()
offset.to_rfc3339_opts(chrono::SecondsFormat::AutoSi, false)
}

pub fn arbitrary_between(start: Timestamp, stop: Timestamp) -> BoxedStrategy<Timestamp> {
Expand Down

0 comments on commit 5a8ad63

Please sign in to comment.