* added hours to fmt_time, refactor to share code in scripts/core-functions.in

git-svn-id: https://svn.exactcode.de/t2/trunk@64561 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
This commit is contained in:
René Rebe 2023-08-06 20:50:52 +00:00
parent 798db4d7d8
commit bc41f8cfc8
3 changed files with 13 additions and 16 deletions

View File

@ -10,6 +10,8 @@
# it under the terms of the GNU General Public License version 2.
# --- T2-COPYRIGHT-NOTE-END ---
. scripts/core-functions.in
if [ "$SDECFG_OUTPUT_TERM_COLOR" = 1 ] ; then
term_color_normal=$'\e[0m'
term_color_error=$'\e[31;1m'
@ -24,13 +26,6 @@ else
term_color_header=
fi
fmt_time() {
[[ "$1" -le 0 ]] && return
[[ "$1" -ge 60 ]] &&
printf " ~%d:%02ds" $(($1 / 60)) $(($1 % 60)) ||
echo " ~$1s"
}
# A free-form header at start of a section usually followed by calls to
# echo_status_terminal().
#

View File

@ -93,15 +93,6 @@ fi
. scripts/parse-config
fmt_time() {
[[ "$1" -le 0 ]] && return
[[ "$1" -ge 60 ]] &&
printf " ~%d:%02ds" $(($1 / 60)) $(($1 % 60)) ||
echo " ~$1s"
}
add_if_req() {
[ "$verbose" = 1 ] && echo -n "$1"

View File

@ -43,6 +43,17 @@ arch2arch32() {
sed 's/[-_]*64//; s/aarch/arm/; s/x86/i686/; s/loongarch/loongarch32/'
}
fmt_time() {
local i=$1 s= u=
s=`printf "%02d" $(($i % 60))` i=$(($i / 60)) u=s
[ $i -gt 0 ] && s=`printf "%02d:$s" $(($i % 60))` i=$(($i / 60)) u=m
[ $i -gt 0 ] && s=`printf "%02d:$s" $i` u=h
echo " ~${s#0}$u"
}
# revert the order of the tokens
get_reverted() {
local queue=