# HG changeset patch # User Aleksej Bobylev # Date 1487729132 -7200 # Node ID 24e5d2229a915422fdaeb2f4779ea6939e2099bf # Parent 50421cb5064482db796ae73ef6eb74a6f580e0a5 modules/summary: fix $((arithmetic)) Busybox ash vs. Bash problem? diff -r 50421cb50644 -r 24e5d2229a91 modules/summary --- a/modules/summary Sun Feb 19 18:05:03 2017 +0000 +++ b/modules/summary Wed Feb 22 04:05:32 2017 +0200 @@ -40,8 +40,15 @@ if [ -e "$IDs" ]; then # Timezone offset as string, ex. '+0200' for EET (+2 hours) ohhmm=$(date +%z) + # offset sign (1; -1) + osign="${ohhmm:0:1}1"; osign=${osign#+} + # offset hours (without leading 0) + ohh=${ohhmm:1:2}; ohh=${ohh#0} + # offset minutes (without leading 0) + omm=${ohhmm:3:2}; omm=${omm#0} # Timezone offset in the seconds - offset=$(( 60 * (60 * ${ohhmm:0:3} + ${ohhmm:3:2}) )) + offset=$(( 60 * (60 * $osign * $ohh + $omm) )) + daynow=$(( ($(date +%s) + $offset) / 86400 )) dayupd=$(( ($(date -r $IDs +%s) + $offset) / 86400 )) days=$(( $daynow - $dayupd ))