Fix broken timestamp logic in do_snapshot(). Thanks to Alon
authorZac Medico <zmedico@gentoo.org>
Thu, 6 Dec 2007 00:19:28 +0000 (00:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 6 Dec 2007 00:19:28 +0000 (00:19 -0000)
Bar-Lev <alonbl@gentoo.org> for this patch.

svn path=/main/trunk/; revision=8851

bin/emerge-webrsync

index bb6e6627c2be7fc2886fd9018555fd63d4fc58f0..eefba192a73133d2bb3330792f7d86662bcab564 100755 (executable)
@@ -61,10 +61,9 @@ get_date_part() {
        fi
 }
 
-get_utc_from_string() {
+get_utc_second_from_string() {
        local s="$1"
-
-       seconds=$(date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s")
+       date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s"
 }
 
 get_portage_timestamp() {
@@ -241,14 +240,14 @@ do_snapshot() {
                                        have_files=0
                                fi
                        else
-                               utc_date=$(get_utc_from_string "${date}")
+                               local utc_seconds=$(get_utc_second_from_string "${date}")
 
                                #
                                # Check that this snapshot
                                # is what it claims to be...
                                #
-                               if [ ${snapshot_timestamp} -lt ${seconds} ] || \
-                                       [ ${snapshot_timestamp} -gt $((${seconds}+ 2*86400)) ]; then
+                               if [ ${snapshot_timestamp} -lt ${utc_seconds} ] || \
+                                       [ ${snapshot_timestamp} -gt $((${utc_seconds}+ 2*86400)) ]; then
 
                                        echo "Warning: Snapshot timestamp is not in acceptable period."
                                        have_files=0