Skip to content

Commit b4462e8

Browse files
authored
Merge pull request #399 from drupol/push-sspusyzutzzs
fix: avoid printf error on floating-point values by using awk
2 parents df9bf75 + 5194e9d commit b4462e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/console_results.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function console_results::print_execution_time() {
106106
return
107107
fi
108108

109-
local time=$(printf "%.0f" "$(clock::total_runtime_in_milliseconds)")
109+
local time=$(clock::total_runtime_in_milliseconds | awk '{printf "%.0f", $1}')
110110

111111
if [[ "$time" -lt 1000 ]]; then
112112
printf "${_COLOR_BOLD}%s${_COLOR_DEFAULT}\n" \
@@ -116,7 +116,7 @@ function console_results::print_execution_time() {
116116

117117
local time_in_seconds=$(( time / 1000 ))
118118
local remainder_ms=$(( time % 1000 ))
119-
local formatted_seconds=$(printf "%.2f" "$time_in_seconds.$remainder_ms")
119+
local formatted_seconds=$(echo "$time_in_seconds.$remainder_ms" | awk '{printf "%.0f", $1}')
120120

121121
printf "${_COLOR_BOLD}%s${_COLOR_DEFAULT}\n" \
122122
"Time taken: $formatted_seconds s"

0 commit comments

Comments
 (0)