summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamen Mladenov <kamen@syndamia.com>2024-11-07 09:19:25 +0200
committerKamen Mladenov <kamen@syndamia.com>2024-11-07 09:19:25 +0200
commit9d868fd8ac36f96f7197a67eba3d26c31ef966df (patch)
treea6468314d71ce5e2440323407e0672e058b17793
parent4b1fbc1d707bd46beae059567f342cecf560630a (diff)
downloaddotfiles-9d868fd8ac36f96f7197a67eba3d26c31ef966df.tar
dotfiles-9d868fd8ac36f96f7197a67eba3d26c31ef966df.tar.gz
dotfiles-9d868fd8ac36f96f7197a67eba3d26c31ef966df.zip
fix(bash): Proper(-ish) handling of seconds duration time
Hour is no longer 2 hours ahead. Added display for days, but unfortunately it starts with 001, so if one day has passed it will show 002.
-rw-r--r--.bashrc7
1 files changed, 4 insertions, 3 deletions
diff --git a/.bashrc b/.bashrc
index 1a783c7..fbe76ca 100644
--- a/.bashrc
+++ b/.bashrc
@@ -120,9 +120,10 @@
if [ "$seconds" -gt 10 ]
then
left_cap $PS_DBG $PS_LEFT_SLAB
- if [ "$seconds" -lt 60 ]; then printf '%ds' "$seconds"
- elif [ "$seconds" -le 3600 ]; then printf '%(%Mm %Ss)T' "$seconds"
- else printf '%($Hh %Mm $%Ss)T' "$seconds"
+ if [ "$seconds" -lt 60 ]; then TZ='UTC' printf '%ds' "$seconds"
+ elif [ "$seconds" -le 3600 ]; then TZ='UTC' printf '%(%Mm %Ss)T' "$seconds"
+ elif [ "$seconds" -le 86400 ]; then TZ='UTC' printf '%(%Hh %Mm %Ss)T' "$seconds"
+ else TZ='UTC' printf '%(%j %Hh %Mm %Ss)T' "$seconds" # Day of the year, starting from 001
fi
right_cap $PS_DBG "$(right_slab dir)"
fi