postpercent=$(echo "${acpi}" | grep -o "[0-9]*%" | cut -f1 -d%)
- let diffmin=($(date +%s -d ${date})-$(date +%s -d ${predate}))/60
+ let diffsecs=($(date +%s -d ${date})-$(date +%s -d ${predate}))
let diffperc=(prepercent-postpercent)
- addendum="${addendum} Discharged ${diffperc}% (${prepercent}% -> ${postpercent}%) in ${diffmin} minutes."
+ days=$(date -u -d @${diffsecs} +'%j')
+ let days=($days-1)
+
+ addendum="${addendum} Discharged ${diffperc}% (${prepercent}% -> ${postpercent}%) in time ${days} days $(date -u -d @${diffsecs} +'%T')."
fi
fi