From 2010fd057606ce594775ae01ad2f081cd7656b41 Mon Sep 17 00:00:00 2001 From: Von Random Date: Wed, 11 Mar 2015 18:00:03 +0300 Subject: [PATCH] added a small function to my shellrc --- shellrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shellrc b/shellrc index 3ce6217..1d384b4 100644 --- a/shellrc +++ b/shellrc @@ -113,6 +113,20 @@ hide-info() { unhide-info() { unset hide_info } + +seconds-to-hr() { + local seconds d h m s + seconds=$1 + if ((seconds)); then + (( + d=seconds/86400, + h=seconds/3600%24, + m=seconds/60%60, + s=seconds%60 + )) + printf '%sd %sh %sm %ss\n' $d $h $m $s + fi +} # }}} if is_zsh; then # zsh