public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 proxmox] time: drop trailing space when not showing seconds at end
Date: Fri, 11 Oct 2024 11:33:54 +0200	[thread overview]
Message-ID: <20241011093355.218198-1-c.ebner@proxmox.com> (raw)

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


             reply	other threads:[~2024-10-11  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  9:33 Christian Ebner [this message]
2024-10-11  9:33 ` [pbs-devel] [PATCH v3 proxmox-backup] partial fix #5560: client: periodically show backup progress Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241011093355.218198-1-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal