aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Lisina <sekoohaka.sarisan@gmail.com>2025-05-20 20:57:07 +0500
committerMaria Lisina <sekoohaka.sarisan@gmail.com>2025-05-20 20:57:07 +0500
commit70d5c932270afde144b62c19c60966ee97c4f889 (patch)
treebb5b077eab96f383e3cf41102b540529c62921c9
parentde659bd677437a9275641090736e6f05adcd421d (diff)
bot: Use zsh/datetime instead of busybox date
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
-rw-r--r--README.md1
-rwxr-xr-xbot.zsh2
-rw-r--r--modules/uncache.zsh2
-rw-r--r--units/ib_auth.zsh2
-rw-r--r--units/ib_date.zsh6
-rw-r--r--units/ib_file.zsh2
-rw-r--r--units/ib_token.zsh2
-rw-r--r--units/log.zsh2
8 files changed, 9 insertions, 10 deletions
diff --git a/README.md b/README.md
index b596a86..573effc 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,6 @@ For distribution specific installation commands follow [command-not-found](https
* cat
* cp
* cut
-* date
* find
* grep
* ls
diff --git a/bot.zsh b/bot.zsh
index 8c99516..9519438 100755
--- a/bot.zsh
+++ b/bot.zsh
@@ -151,7 +151,7 @@ then
exit 1
fi
-for function in base64 cat cp cut date find grep ls mkdir rm sed sort sha1sum sleep stat tr
+for function in base64 cat cp cut find grep ls mkdir rm sed sort sha1sum sleep stat tr
do
if busybox ${function} --help > /dev/null
then
diff --git a/modules/uncache.zsh b/modules/uncache.zsh
index 0e6df74..746a87e 100644
--- a/modules/uncache.zsh
+++ b/modules/uncache.zsh
@@ -19,7 +19,7 @@ do
sleep 1
done
- cache_ctime=$(date +%s)
+ cache_ctime=$(strftime %s)
cache_mtime=$(stat -c %Y "${cache}/${file}")
if [[ $((cache_ctime - cache_mtime)) -gt $((caching_time + 15)) ]]
diff --git a/units/ib_auth.zsh b/units/ib_auth.zsh
index 4db0a49..ce55170 100644
--- a/units/ib_auth.zsh
+++ b/units/ib_auth.zsh
@@ -154,7 +154,7 @@ case "${ib_board}" in
fi
jq -r '.access_token' "${ib_auth_file}" > "${user_config}/${ib_config}/token"
- date +%s > "${user_config}/${ib_config}/timestamp"
+ strftime %s > "${user_config}/${ib_config}/timestamp"
;;
(k|y)
ib_auth_file="${cache}/${update_id}_user.json"
diff --git a/units/ib_date.zsh b/units/ib_date.zsh
index 803a386..f895e07 100644
--- a/units/ib_date.zsh
+++ b/units/ib_date.zsh
@@ -11,8 +11,8 @@ then
if [[ -n "${ib_idate}" ]]
then
- ib_date_text="$(date -ud "${ib_created_at}" -D "${ib_idate}" +"%Y-%m-%d %H:%M")"
- else
- ib_date_text="$(date -ud "@${ib_created_at}" +"%Y-%m-%d %H:%M")"
+ ib_created_at="$(strftime -r "${ib_idate}" "${ib_created_at}")"
fi
+
+ ib_date_text="$(strftime "%Y-%m-%d %H:%M" "${ib_created_at}")"
fi
diff --git a/units/ib_file.zsh b/units/ib_file.zsh
index 892f920..7a949c3 100644
--- a/units/ib_file.zsh
+++ b/units/ib_file.zsh
@@ -12,7 +12,7 @@ dump=(${dump[@]} ${ib_file##*/})
if [[ -f "${ib_file}" && "${caching_mode}" != "none" ]]
then
- ib_ctime=$(date +%s)
+ ib_ctime=$(strftime %s)
ib_mtime=$(stat -c %Y "${ib_file}")
if [[ $((ib_ctime - ib_mtime)) -le $((caching_time - 15)) ]]
diff --git a/units/ib_token.zsh b/units/ib_token.zsh
index b503bcc..7b51a69 100644
--- a/units/ib_token.zsh
+++ b/units/ib_token.zsh
@@ -14,7 +14,7 @@ fi
if [[ -f "${user_config}/${ib_config}/timestamp" ]]
then
- ib_ctime=$(date +%s)
+ ib_ctime=$(strftime %s)
ib_mtime=$(cat "${user_config}/${ib_config}/timestamp")
if [[ $((ib_ctime - ib_mtime)) -gt ${ib_expire} ]]
diff --git a/units/log.zsh b/units/log.zsh
index 2e5b972..26aa31c 100644
--- a/units/log.zsh
+++ b/units/log.zsh
@@ -7,4 +7,4 @@ then
return 0
fi
-printf "[%s] %s\n" "$(date +"%Y-%m-%d %X")" "${log_text}"
+printf "[%s] %s\n" "$(strftime "%Y-%m-%d %X")" "${log_text}"