From ba430055c20b26bd97c0a495a2dab3c806e0a5f3 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 15 Aug 2024 00:16:16 +0300 Subject: [PATCH] [timeutil] Improve formatting of days and seconds in 'MiniDuration' --- CHANGELOG.md | 4 ++++ Makefile | 1 + timeutil/timeutil.go | 4 ++-- version.go | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 662c603f..9ae19cc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### [13.3.5](https://kaos.sh/ek/13.3.5) + +- `[timeutil]` Improved formatting of days and seconds in `MiniDuration` + ### [13.3.4](https://kaos.sh/ek/13.3.4) - `[timeutil]` Added support of minutes, hours and days to `MiniDuration` diff --git a/Makefile b/Makefile index 9d655cbf..839caa77 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ ################################################################################ export EK_TEST_PORT=8080 +export CGO_ENABLED=1 ifdef VERBOSE ## Print verbose information (Flag) VERBOSE_FLAG = -v diff --git a/timeutil/timeutil.go b/timeutil/timeutil.go index a1053c8e..029ed679 100644 --- a/timeutil/timeutil.go +++ b/timeutil/timeutil.go @@ -773,7 +773,7 @@ func getPrettyShortDuration(d time.Duration, separator string) string { switch { case d >= 24*time.Hour: return fmt.Sprintf( - "%.0g"+separator+"d", + "%.0f"+separator+"d", formatFloat(float64(d)/float64(24*time.Hour)), ) @@ -791,7 +791,7 @@ func getPrettyShortDuration(d time.Duration, separator string) string { case d >= time.Second: return fmt.Sprintf( - "%g"+separator+"s", + "%.2g"+separator+"s", formatFloat(float64(d)/float64(time.Second)), ) diff --git a/version.go b/version.go index 4c281629..5b713d4b 100644 --- a/version.go +++ b/version.go @@ -8,4 +8,4 @@ package ek // ////////////////////////////////////////////////////////////////////////////////// // // VERSION is current ek package version -const VERSION = "13.3.4" +const VERSION = "13.3.5"