1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-10 20:39:15 +00:00

refactor: standardize epoch time retrieval with get_epoch_seconds and ensure locale-independent string transformations.

This commit is contained in:
Tw93
2026-01-03 18:07:47 +08:00
parent 4efe1411aa
commit 6dfd675417
15 changed files with 79 additions and 41 deletions

View File

@@ -16,7 +16,7 @@ clean_homebrew() {
local last_cleanup
last_cleanup=$(cat "$brew_cache_file" 2> /dev/null || echo "0")
local current_time
current_time=$(date +%s)
current_time=$(get_epoch_seconds)
local time_diff=$((current_time - last_cleanup))
local days_diff=$((time_diff / 86400))
if [[ $days_diff -lt $cache_valid_days ]]; then
@@ -112,6 +112,6 @@ clean_homebrew() {
# Update cache timestamp when any work succeeded or was intentionally skipped.
if [[ "$skip_cleanup" == "true" ]] || [[ "$brew_success" == "true" ]] || [[ "$autoremove_success" == "true" ]]; then
ensure_user_file "$brew_cache_file"
date +%s > "$brew_cache_file"
get_epoch_seconds > "$brew_cache_file"
fi
}