all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v3 proxmox] time: drop trailing space when not showing seconds at end
@ 2024-10-11  9:33 Christian Ebner
  2024-10-11  9:33 ` [pbs-devel] [PATCH v3 proxmox-backup] partial fix #5560: client: periodically show backup progress Christian Ebner
  2024-10-17 13:16 ` [pbs-devel] applied: [PATCH v3 proxmox] time: drop trailing space when not showing seconds at end Thomas Lamprecht
  0 siblings, 2 replies; 12+ messages in thread
From: Christian Ebner @ 2024-10-11  9:33 UTC (permalink / raw)
  To: pbs-devel

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>
---
changes since version 2:
- not present in previous version

 proxmox-time/src/time_span.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxmox-time/src/time_span.rs b/proxmox-time/src/time_span.rs
index 2ccdf08b..2f8dd1c1 100644
--- a/proxmox-time/src/time_span.rs
+++ b/proxmox-time/src/time_span.rs
@@ -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 {
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-10-18 12:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-11  9:33 [pbs-devel] [PATCH v3 proxmox] time: drop trailing space when not showing seconds at end Christian Ebner
2024-10-11  9:33 ` [pbs-devel] [PATCH v3 proxmox-backup] partial fix #5560: client: periodically show backup progress Christian Ebner
2024-10-17 15:02   ` [pbs-devel] applied: " Thomas Lamprecht
2024-10-17 15:53     ` Christian Ebner
2024-10-18  7:20       ` Thomas Lamprecht
2024-10-18  7:37         ` Christian Ebner
2024-10-18  7:53           ` Thomas Lamprecht
2024-10-18  8:33             ` Christian Ebner
2024-10-18 12:13               ` Thomas Lamprecht
2024-10-17 13:16 ` [pbs-devel] applied: [PATCH v3 proxmox] time: drop trailing space when not showing seconds at end Thomas Lamprecht
2024-10-17 14:40   ` Christian Ebner
2024-10-18 12:12     ` Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal