tazpkg rev 944
modules/summary: fix $((arithmetic))
Busybox ash vs. Bash problem?
Busybox ash vs. Bash problem?
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Feb 22 04:05:32 2017 +0200 (2017-02-22) |
parents | 50421cb50644 |
children | f2c91eb0a058 |
files | modules/summary |
line diff
1.1 --- a/modules/summary Sun Feb 19 18:05:03 2017 +0000 1.2 +++ b/modules/summary Wed Feb 22 04:05:32 2017 +0200 1.3 @@ -40,8 +40,15 @@ 1.4 if [ -e "$IDs" ]; then 1.5 # Timezone offset as string, ex. '+0200' for EET (+2 hours) 1.6 ohhmm=$(date +%z) 1.7 + # offset sign (1; -1) 1.8 + osign="${ohhmm:0:1}1"; osign=${osign#+} 1.9 + # offset hours (without leading 0) 1.10 + ohh=${ohhmm:1:2}; ohh=${ohh#0} 1.11 + # offset minutes (without leading 0) 1.12 + omm=${ohhmm:3:2}; omm=${omm#0} 1.13 # Timezone offset in the seconds 1.14 - offset=$(( 60 * (60 * ${ohhmm:0:3} + ${ohhmm:3:2}) )) 1.15 + offset=$(( 60 * (60 * $osign * $ohh + $omm) )) 1.16 + 1.17 daynow=$(( ($(date +%s) + $offset) / 86400 )) 1.18 dayupd=$(( ($(date -r $IDs +%s) + $offset) / 86400 )) 1.19 days=$(( $daynow - $dayupd ))