--- ./apt.old 2009-04-08 12:12:46.000000000 -0300 +++ ./apt 2009-04-08 13:04:02.000000000 -0300 @@ -49,8 +49,18 @@ return 0 fi + # Due to some timezones returning 'invalid date' for the start of DST + # (eg America/Sao_Paulo), if the file has an invalid date, remove the stamp + # file and return 0. See coreutils bug: + # http://lists.gnu.org/archive/html/bug-coreutils/2007-09/msg00176.html + stamp_date=$(date -r $stamp --iso-8601) + if [ "$?" != "0" ]; then + rm -f $stamp + return 0 + fi + # compare midnight today to midnight the day the stamp was updated - stamp=$(date --date=$(date -r $stamp --iso-8601) +%s) + stamp=$(date --date=$stamp_date +%s) now=$(date --date=$(date --iso-8601) +%s) delta=$(($now-$stamp))