Skip to content

Commit

Permalink
lib/command_duration: avoid relying on a specific locale
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Nov 18, 2024
1 parent d3a4ade commit d3e0b3a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/command_duration.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
# Get shell duration in decimal format regardless of runtime locale.
# Notice: This function runs as a sub-shell - notice '(' vs '{'.
function _shell_duration_en() (
# DFARREL You would think LC_NUMERIC would do it, but not working in my local
LC_ALL='en_US.UTF-8'
# DFARREL You would think LC_NUMERIC would do it, but not working in my local.
# Note: LC_ALL='en_US.UTF-8' has been used to enforce the decimal point to be
# a period, but the specific locale 'en_US.UTF-8' is not ensured to exist in
# the system. One should instead use the locale 'C', which is ensured by the
# C and POSIX standards.
local LC_ALL=C
printf "%s" "${EPOCHREALTIME:-$SECONDS}"
)

Expand Down

0 comments on commit d3e0b3a

Please sign in to comment.