Finally simplify the time calculations!
According to http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html a shell must be able to do modulus (=remainder). Zsh, bash and dash confirm this and thus I can save another line and get rid of a very ugly one. Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
parent
545158b56f
commit
f630bef3b5
1 changed files with 5 additions and 5 deletions
10
ccollect.sh
10
ccollect.sh
|
@ -560,14 +560,14 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
|
|||
fi
|
||||
fi
|
||||
|
||||
# Calculation
|
||||
#
|
||||
# Time calculation
|
||||
#
|
||||
end_s="$(${SDATE})"
|
||||
|
||||
full_seconds="$((${end_s} - ${begin_s}))"
|
||||
hours="$((${full_seconds} / 3600))"
|
||||
seconds="$((${full_seconds} - (${hours} * 3600)))"
|
||||
minutes="$((${seconds} / 60))"
|
||||
seconds="$((${seconds} - (${minutes} * 60)))"
|
||||
minutes="$(((${full_seconds} % 3600) / 60))"
|
||||
seconds="$((${full_seconds} % 60))"
|
||||
|
||||
_techo "Backup lasted: ${hours}:${minutes}:${seconds} (h:m:s)"
|
||||
) | add_name
|
||||
|
|
Loading…
Reference in a new issue