From 1307b0c3b02072708df70409b57f9421f4f9be23 Mon Sep 17 00:00:00 2001 From: Devops Date: Wed, 26 Apr 2017 10:49:13 +0100 Subject: [PATCH] etc/profile.d/functions --- etc/profile.d/functions | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/etc/profile.d/functions b/etc/profile.d/functions index fb80ef44..2b006e8f 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -280,6 +280,21 @@ while (<>) { ' } +secs2h () { + local T=$1 + local D=$((T/60/60/24)) + local H=$((T/60/60%24)) + local M=$((T/60%60)) + local S=$((T%60)) + + if [[ ${D} != 0 ]] + then + printf '%d days %02d:%02d:%02d' $D $H $M $S + else + printf '%02d:%02d:%02d' $H $M $S + fi +} + bytes2h() { local in args -- 2.47.3