[fix] Use UTC date reference to avoid repeating S3 downloads.

Resolves https://github.com/openvenues/libpostal/issues/143
This commit is contained in:
Brad Hards
2016-12-26 12:04:02 +11:00
parent 191fc20841
commit fb68e22bbf

View File

@@ -115,8 +115,8 @@ download_file() {
curl $url --retry 3 --retry-delay 2 -o $local_path
fi
if date -d "@$(date -ur . +%s)" >/dev/null 2>&1; then
echo $(date -d "$(date -d "@$(date -ur $local_path +%s)") + 1 second") > $updated_path;
if date -ud "@$(date -ur . +%s)" >/dev/null 2>&1; then
echo $(date -ud "$(date -ud "@$(date -ur $local_path +%s)") + 1 second") > $updated_path;
elif stat -f %Sm . >/dev/null 2>&1; then
echo $(date -ur $(stat -f %m $local_path) -v+1S) > $updated_path;
fi;