From afd655fbaf1e8fa73f42df94a31c76bf17cfdedb Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 1 Nov 2009 02:22:52 +0100 Subject: [PATCH] check_interval: More semantic changes --- daemons/gc.sh | 2 +- daemons/update.sh | 2 +- shlib.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/daemons/gc.sh b/daemons/gc.sh index 5fdee30..61b02fa 100755 --- a/daemons/gc.sh +++ b/daemons/gc.sh @@ -7,7 +7,7 @@ set -e proj="$1" cd "$cfg_reporoot/$proj.git" -if ! check_interval lastgc $cfg_min_gc_interval; then +if check_interval lastgc $cfg_min_gc_interval; then progress "= [$proj] garbage check skip (last at $(config_get lastgc))" exit 0 fi diff --git a/daemons/update.sh b/daemons/update.sh index 95dc58f..b44499d 100755 --- a/daemons/update.sh +++ b/daemons/update.sh @@ -7,7 +7,7 @@ set -e proj="$1" cd "$cfg_reporoot/$proj.git" -if ! check_interval lastrefresh $cfg_min_mirror_interval; then +if check_interval lastrefresh $cfg_min_mirror_interval; then progress "= [$proj] update skip (last at $(config_get lastrefresh))" exit 0 fi diff --git a/shlib.sh b/shlib.sh index e4271d4..35b4752 100644 --- a/shlib.sh +++ b/shlib.sh @@ -73,14 +73,14 @@ config_set() { } -# Tool for checking whether at least given number of seconds passed (true if so) +# Tool for checking whether given number of seconds has not passed yet check_interval() { od="$(config_get "$1")" [ -n "$od" ] || return 1 os="$(date +%s -d "$od")" [ -n "$os" ] || return 1 ns="$(date +%s)" - [ $ns -ge $(($os+$2)) ] + [ $ns -lt $(($os+$2)) ] } -- 2.11.4.GIT