projects
/
nihav-player.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
98431ed
)
format time with hours
author
Kostya Shishkov
<kostya.shishkov@gmail.com>
Sat, 17 Oct 2020 08:11:20 +0000
(10:11 +0200)
committer
Kostya Shishkov
<kostya.shishkov@gmail.com>
Sat, 17 Oct 2020 08:11:20 +0000
(10:11 +0200)
sndplay/src/main.rs
patch
|
blob
|
blame
|
history
diff --git
a/sndplay/src/main.rs
b/sndplay/src/main.rs
index 990507d963cd452e48f1c3e787e19c4725923f73..176a6d189d8e55b3821ca9c747aa17513ad4b81d 100644
(file)
--- a/
sndplay/src/main.rs
+++ b/
sndplay/src/main.rs
@@
-193,10
+193,15
@@
fn format_time(ms: u64) -> String {
let s = ms / 1000;
let ds = (ms % 1000) / 100;
let (min, s) = (s / 60, s % 60);
- if min == 0 {
- format!("{}.{}", s, ds)
+ let (h, min) = (min / 60, min % 60);
+ if h == 0 {
+ if min == 0 {
+ format!("{}.{}", s, ds)
+ } else {
+ format!("{}:{:02}.{}", min, s, ds)
+ }
} else {
- format!("{}:{:02}
.{}"
, min, s, ds)
+ format!("{}:{:02}
:{:02}.{}", h
, min, s, ds)
}
}