From 80098d29c609372f5212ae4a0c7cdd534e7f37bd Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Mon, 13 Mar 2023 10:58:37 -0700 Subject: [PATCH] misc:TimeFunc: reduce printed time precision Now: 10:57:41.737665 initramfs-extra completed in: 0.33s ... 10:57:42.008587 boot-deploy completed in: 0.27s 10:57:42.012973 mkinitfs completed in: 0.90s Times is just truncated, not rounding, since it's simpler (no dependency on the math module), and I'm not sure if anyone cares for what this function prints. If there is a desire to return to higher precision later, it could be enabled by a new flag. fixes https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/issues/25 --- internal/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/misc/misc.go b/internal/misc/misc.go index 3d952b4..b072ffe 100644 --- a/internal/misc/misc.go +++ b/internal/misc/misc.go @@ -45,7 +45,7 @@ func RemoveDuplicates(in []string) (out []string) { // defer misc.TimeFunc(time.Now(), "foo") func TimeFunc(start time.Time, name string) { elapsed := time.Since(start) - log.Printf("%s completed in: %s", name, elapsed) + log.Printf("%s completed in: %.2fs", name, elapsed.Seconds()) } // Exists tests if the given file/dir exists or not. Returns any errors related