Skip to content

Commit d3e0b3a

Browse files
committed
lib/command_duration: avoid relying on a specific locale
1 parent d3a4ade commit d3e0b3a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/command_duration.bash

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
# Get shell duration in decimal format regardless of runtime locale.
66
# Notice: This function runs as a sub-shell - notice '(' vs '{'.
77
function _shell_duration_en() (
8-
# DFARREL You would think LC_NUMERIC would do it, but not working in my local
9-
LC_ALL='en_US.UTF-8'
8+
# DFARREL You would think LC_NUMERIC would do it, but not working in my local.
9+
# Note: LC_ALL='en_US.UTF-8' has been used to enforce the decimal point to be
10+
# a period, but the specific locale 'en_US.UTF-8' is not ensured to exist in
11+
# the system. One should instead use the locale 'C', which is ensured by the
12+
# C and POSIX standards.
13+
local LC_ALL=C
1014
printf "%s" "${EPOCHREALTIME:-$SECONDS}"
1115
)
1216

0 commit comments

Comments
 (0)