tazpkg diff modules/summary @ rev 952
Do not hard-code year in docs
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 07 23:53:39 2017 +0200 (2017-10-07) |
parents | a02e36d44d06 |
children |
line diff
1.1 --- a/modules/summary Fri Aug 28 16:10:34 2015 +0300 1.2 +++ b/modules/summary Sat Oct 07 23:53:39 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 ))