Skip to content

Commit

Permalink
Add Info::date_utc to info output
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezyLemon authored and Luni-4 committed Apr 24, 2023
1 parent 08db0fe commit 29f3d6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ matroska = { path = ".." }
nom = "7.0"
pretty_env_logger = "0.4"
err-derive = "0.3.0"
time = { version = "0.3.20", features = ["formatting"] }
14 changes: 14 additions & 0 deletions tools/src/matroska_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@ fn run(filename: &str) -> Result<(), InfoError> {
}
println!("| + Multiplexing application: {}", i.muxing_app);
println!("| + Writing application: {}", i.writing_app);
if let Some(ref date) = i.date_utc {
use time::format_description::well_known::Rfc3339;
use time::{Date, Duration};

let formatted = Date::from_ordinal_date(2001, 1)
.unwrap()
.midnight()
.assume_utc()
.saturating_add(Duration::nanoseconds(date.0))
.format(&Rfc3339)
.unwrap();

println!("| + Date: {formatted}");
}
if info.is_some() {
return Err(InfoError::InfoElement);
} else {
Expand Down

0 comments on commit 29f3d6a

Please sign in to comment.