Skip to content

Commit

Permalink
play: Fix calculation of minutes when printing a time.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeljanov committed Sep 17, 2021
1 parent 9e5874c commit 5f062b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions symphonia-play/src/main.rs
Expand Up @@ -638,7 +638,7 @@ fn fmt_time(ts: u64, tb: TimeBase) -> String {
let time = tb.calc_time(ts);

let hours = time.seconds / (60 * 60);
let mins = time.seconds / 60;
let mins = (time.seconds % (60 * 60)) / 60;
let secs = f64::from((time.seconds % 60) as u32) + time.frac;

format!("{}:{:0>2}:{:0>6.3}", hours, mins, secs)
Expand Down Expand Up @@ -669,7 +669,7 @@ fn print_progress(ts: u64, dur: Option<u64>, tb: Option<TimeBase>) {
let t = tb.calc_time(ts);

let hours = t.seconds / (60 * 60);
let mins = t.seconds / 60;
let mins = (t.seconds % (60 * 60)) / 60;
let secs = f64::from((t.seconds % 60) as u32) + t.frac;

write!(output, "\r⏵ {}:{:0>2}:{:0>4.1}", hours, mins, secs).unwrap();
Expand All @@ -678,7 +678,7 @@ fn print_progress(ts: u64, dur: Option<u64>, tb: Option<TimeBase>) {
let d = tb.calc_time(dur.saturating_sub(ts));

let hours = d.seconds / (60 * 60);
let mins = d.seconds / 60;
let mins = (d.seconds % (60 * 60)) / 60;
let secs = f64::from((d.seconds % 60) as u32) + d.frac;

write!(
Expand Down

0 comments on commit 5f062b7

Please sign in to comment.