Builds taking longer than a day to run

Ade Lovett ade at freebsd.org
Thu Jul 31 01:09:37 EDT 2008


On Jul 30, 2008, at 17:30 , Joe Marcus Clarke wrote:
> What about doing this with expr:
>
> timediff=$((${end} - ${start}))
> days=0
> if [ ${timediff} -ge 86400 ]; then
>    days=$((${timediff} / 86400))
> fi
> echo "phase ${num} took ${days} days $(env LANG=C date -u -j -r
> ${timediff}) | awk '{print $4}'

Slightly cleaner version (pet peeve "1 days"):

echo -n "phase ${num} took "
duration=$((${end} - ${start}))
days=$((${duration} / 86400))
case ${days} in
     0)	;;
     1)  echo -n "1 day ";;
     *)  echo -n "${days} days ";;
esac
echo "$(env LANG=C date -u -j -r ${duration} | awk '{print $4}')"

-aDe



More information about the tinderbox-list mailing list