Skip to content

Commit

Permalink
Format start and end times in capture metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Nov 7, 2024
1 parent 7eaeaae commit 694fe68
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
60 changes: 60 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ hidreport = "0.4.1"
hut = "0.2.1"
byteorder_slice = "3.0.0"
merge = "0.1.0"
chrono = { version = "0.4.38", default-features = false, features = ["clock"] }

[dev-dependencies]
serde = { version = "1.0.196", features = ["derive"] }
Expand Down
4 changes: 3 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::net::TcpListener;
use std::sync::Mutex;

use anyhow::{Context as ErrorContext, Error, bail};
use chrono::{DateTime, Local};
use bytemuck::bytes_of;

use gtk::gio::{
Expand Down Expand Up @@ -1594,7 +1595,8 @@ fn show_metadata() -> Result<(), Error> {
("End time", &meta.end_time),
] {
let text = field
.map(|s| format!("{s:?}"))
.map(|s| format!("{}",
DateTime::<Local>::from(s).format("%c")))
.unwrap_or(NONE.to_string());
add_field(row, name, &text);
}
Expand Down

0 comments on commit 694fe68

Please sign in to comment.