only do date calc once for perf
This commit is contained in:
parent
f027208f58
commit
b37fdc634c
1 changed files with 7 additions and 4 deletions
11
blag
11
blag
|
@ -90,11 +90,14 @@ render() {(
|
|||
path=$1
|
||||
shift
|
||||
|
||||
birth=$(stat -c'%W' "$path")
|
||||
if (( birth > 0 )); then
|
||||
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
|
||||
if (( ! DATES_CALCULATED )); then
|
||||
birth=$(stat -c'%W' "$path")
|
||||
if (( birth > 0 )); then
|
||||
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
|
||||
fi
|
||||
MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$path")")
|
||||
DATES_CALCULATED=1
|
||||
fi
|
||||
MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$path")")
|
||||
|
||||
#shellcheck disable=SC1090
|
||||
. "$path" "$@"
|
||||
|
|
Loading…
Reference in a new issue