mirror of
https://github.com/rxrbln/t2sde.git
synced 2025-05-08 20:21:59 +08:00
* 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:
parent
798db4d7d8
commit
bc41f8cfc8
@ -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().
|
||||
#
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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=
|
||||
|
Loading…
x
Reference in New Issue
Block a user