From 87225031120dbfe0d9b7e57063ec9f717ead4c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 12 Apr 2026 20:10:01 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20temps=20d'ex=C3=A9cution=20+=20heure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private_dot_config/zsh/dot_zshrc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/private_dot_config/zsh/dot_zshrc b/private_dot_config/zsh/dot_zshrc index 7d3bd97..53ad16d 100644 --- a/private_dot_config/zsh/dot_zshrc +++ b/private_dot_config/zsh/dot_zshrc @@ -113,8 +113,19 @@ POWERLINE_STOP="\ue0b4" PROMPT_ENTER="" #"\ueb70" precmd() { + local exec_ts=$(($(date +%s%N) - STARTCMD_TS)) + local seconds=$(echo "scale=9; $exec_ts / 1000000000" | bc) + local hours=$((seconds / 3600)) + local minutes=$(((seconds % 3600) / 60)) + seconds=$((seconds % 60)) + local exec_str=$(printf "%02d:%02d:%06.3f" hours minutes seconds) + print "" # empty line to increase readability - print -P "%F{${BG1}}${POWERLINE_START}%K{${BG1}}%F{${FG1}} %y on %M %K{${BG1}}%F{${BG2}}${POWERLINE_SEPARATOR}%K{${BG2}}%F{${FG2}} %n %K{${BG2}}%F{${BG3}}${POWERLINE_SEPARATOR}%K{${BG3}}%F{${FG3}} %~ %K{${BG3}}%F{${FG4}}${POWERLINE_SEPARATOR}%k%F{${FG4}}${POWERLINE_STOP}" + print -P "%F{${BG1}}${POWERLINE_START}%K{${BG1}}%F{${FG1}} %y on %M %K{${BG1}}%F{${BG2}}${POWERLINE_SEPARATOR}%K{${BG2}}%F{${FG2}} %n %K{${BG2}}%F{${BG3}}${POWERLINE_SEPARATOR}%K{${BG3}}%F{${FG3}} %~ %K{${BG3}}%F{${FG4}}${POWERLINE_SEPARATOR}%k%F{${FG4}}${POWERLINE_STOP}%k%f...%K{${BG3}}%F{${FG3}} took ${exec_str} \uf252 %K{${BG2}}%F{${FG2}} at $(date +%H:%M:%S) \uf017" +} + +preexec() { + STARTCMD_TS=$(date +%s%N) } PROMPT="${PROMPT_ENTER} " # nord theme