From a57976f75af07822fc3a0b606a81ddc8f864e016 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 6 Dec 2007 00:19:28 +0000 Subject: Fix broken timestamp logic in do_snapshot(). Thanks to Alon Bar-Lev for this patch. svn path=/main/trunk/; revision=8851 --- bin/emerge-webrsync | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'bin/emerge-webrsync') diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index bb6e6627c..eefba192a 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -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 -- cgit v1.2.3-1-g7c22