Skip to content

Commit

Permalink
simplify _shell_duration_en: use local declaration instead of subshell
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebman committed Oct 26, 2024
1 parent dd752a3 commit b0dd03f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/command_duration.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
# Functions for measuring and reporting how long a command takes to run.

# Get shell duration in decimal format regardless of runtime locale.
# Notice: This function runs as a sub-shell - notice '(' vs '{'.
function _shell_duration_en() (
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'
local LC_ALL='en_US.UTF-8'
printf "%s" "${EPOCHREALTIME:-$SECONDS}"
)
}

: "${COMMAND_DURATION_START_SECONDS:=$(_shell_duration_en)}"
: "${COMMAND_DURATION_ICON:=🕘}"
Expand Down

0 comments on commit b0dd03f

Please sign in to comment.