Fix code for absolute time

This commit is contained in:
Benoit Vianin
2023-11-04 18:53:42 +00:00
parent 06cfba4952
commit 6a28ac2d92

View File

@@ -25,8 +25,12 @@ else
target_time=$(($current_time + $waittime))
elif [[ $DB_DUMP_BEGIN =~ ^[0-9]+$ ]]; then
print_debug "DB_DUMP_BEGIN is an integer."
waittime=$(( ${BASH_REMATCH[1]} * 60 ))
target_time=$(($current_time + $waittime))
target_time=$(date --date="${today}${DB_DUMP_BEGIN}" +"%s")
if [[ "$target_time" < "$current_time" ]]; then
target_time=$(($target_time + 24*60*60))
fi
waittime=$(($target_time - $current_time))
elif [[ $DB_DUMP_BEGIN =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})[[:space:]]([0-9]{2}):([0-9]{2}):([0-9]{2})$ ]];
then
# Extract year, month, day, hours, minutes, and seconds from DB_DUMP_BEGIN