summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main.sh b/src/main.sh
index d64de0e..054363d 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -34,6 +34,24 @@ else
builddir=''
fi
+time()
+{
+ # Based on code from <https://www.etalabs.net/sh_tricks.html> by Rich
+ # Felker, with whitespace added for readability.
+ printf '%d' $(($(TZ=UTC0 date "+
+ (
+ (%Y - 1600) * 365
+ + (%Y - 1600) / 4
+ - (%Y - 1600) / 100
+ + (%Y - 1600) / 400
+ + 1%j - 1000
+ - 135140
+ ) * 86400
+ + (1%H - 100) * 3600
+ + (1%M - 100) * 60
+ + (1%S - 100)")))
+}
+
main()
{
local cmd=
@@ -61,7 +79,7 @@ main()
shift
fi
- srand $(expr ${$} + $(date '+%s'))
+ srand $((${$} + $(time)))
if ! init_vardata; then
return 2
fi