]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: round the timeout up 40125/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Nov 2025 11:53:20 +0000 (12:53 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 4 Jan 2026 12:58:37 +0000 (13:58 +0100)
I think this is better: if I specify 0.5s, I'd be suprised if the
menu didn't show up at all.

src/bootctl/bootctl-set-efivar.c

index 360664b879f75a22a85dc8c57876041af095532f..82770dd6c6c34eaff63e03deb791fbebbd4aaab0 100644 (file)
@@ -74,8 +74,10 @@ static int parse_timeout(const char *arg1, char16_t **ret_timeout, size_t *ret_t
                 arg1 = NULL;
         }
 
-        if (!arg1)
-                xsprintf(buf, USEC_FMT, MIN(timeout / USEC_PER_SEC, UINT32_MAX));
+        if (!arg1) {
+                timeout = DIV_ROUND_UP(timeout, USEC_PER_SEC);
+                xsprintf(buf, USEC_FMT, MIN(timeout, UINT32_MAX));
+        }
 
         char16_t *encoded = utf8_to_utf16(arg1 ?: buf, SIZE_MAX);
         if (!encoded)