forked from Proxmox/proxmox
time: drop trailing space when not showing seconds at end
Seconds are not displayed when the value is smaller than 0.1s and they are not at the start of the display output, e.g. `1h 2m`. Drop the additional whitespace currently appended for this edge case. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
c76090b907
commit
67822186a2
@ -170,11 +170,11 @@ impl std::fmt::Display for TimeSpan {
|
||||
do_write(self.minutes, "min")?;
|
||||
}
|
||||
}
|
||||
if !first {
|
||||
write!(f, " ")?;
|
||||
}
|
||||
let seconds = self.seconds as f64 + (self.msec as f64 / 1000.0);
|
||||
if seconds >= 0.1 {
|
||||
if !first {
|
||||
write!(f, " ")?;
|
||||
}
|
||||
if seconds >= 1.0 || !first {
|
||||
write!(f, "{:.0}s", seconds)?;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user