From de3dcae1f2d57f3ec670ba7082809b2addf2ba14 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Thu, 7 Aug 2025 15:11:17 +0200 Subject: [PATCH] quickfix: replace calls to `date` with builtin `printf` or $EPOCHSECONDS --- atom | 8 ++++---- lib/files/getFiles | 2 +- toys/createindex | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom b/atom index c9d32e9..445277b 100755 --- a/atom +++ b/atom @@ -555,16 +555,16 @@ echo "Created ${count:-0} tasks for $filecount files ${togo:+($togo left) }(${co concurrency=$(( maxload / 2 )) (( concurrency )) || concurrency=1 active=0 -concurrencychange=$(date +%s) +concurrencychange=$EPOCHSECONDS starttime=$concurrencychange taskcount=$count remaining=$taskcount failed=0 echo 'BEGIN TRANSACTION;' >&3 -committime=$(date +%s) +committime=$EPOCHSECONDS while (( (remaining || ${#workers[@]}) && ! quit )) do - timestamp=$(date +%s) + timestamp=$EPOCHSECONDS if (( $timestamp - committime >= 60 )) then echo $'COMMIT;\nBEGIN TRANSACTION;' >&3 @@ -673,7 +673,7 @@ done echo 'COMMIT;' >&3 unset count -endtime=$(date +%s) +endtime=$EPOCHSECONDS (( elapsedseconds = endtime - starttime - pausedtime )) (( days = diff --git a/lib/files/getFiles b/lib/files/getFiles index 8e9daf5..f6c28db 100644 --- a/lib/files/getFiles +++ b/lib/files/getFiles @@ -1,6 +1,6 @@ #!/bin/bash getFiles() { - scantime=$(date +%s) + scantime=$EPOCHSECONDS for prune_expression in "${skippeddirectories[@]}" do prunes+=( -path "$sourcepath$prune_expression" -prune -o ) diff --git a/toys/createindex b/toys/createindex index 3959755..eed7966 100755 --- a/toys/createindex +++ b/toys/createindex @@ -287,12 +287,12 @@ cat <<-EOBrag # # $0 $args # - # Last database update: $(date -d @$lastupdate +'%x %X') + # Last database update: $EPOCHSECONDS EOBrag printDate() { - date -d"@$1" +"${timeformat:-%x %X}" + printf "%("${timeformat:-%x %X}")T "$1" } for index in ${!show[@]}