aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-09 09:34:58 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-09 09:34:58 +1300
commit19d1d88b5fa202530ab8405365ac7e4fc72ecbf4 (patch)
treee076395138bac1d8cb634b2f9de27eb1a29b70a8
parentAdd sec(1df) (diff)
downloaddotfiles-19d1d88b5fa202530ab8405365ac7e4fc72ecbf4.tar.gz
dotfiles-19d1d88b5fa202530ab8405365ac7e4fc72ecbf4.zip
Add uts(1df)
-rw-r--r--README.markdown2
-rwxr-xr-xbin/uts4
-rw-r--r--man/man1/uts.1df16
3 files changed, 22 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index 153317ea..3c692ae5 100644
--- a/README.markdown
+++ b/README.markdown
@@ -488,6 +488,8 @@ Installed by the `install-bin` target:
tolerating blips or temporary failures in `cron(8)` scripts.
* `umake(1df)` iterates upwards through the directory tree from `$PWD` until
it finds a Makefile for which to run `make(1)` with the given arguments.
+* `uts(1df)` gets the current UNIX timestamp in an unorthodox way that should
+ work on all POSIX-compliant operating systems.
There's some silly stuff in `install-games`:
diff --git a/bin/uts b/bin/uts
new file mode 100755
index 00000000..8777a7e2
--- /dev/null
+++ b/bin/uts
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Get the current timestamp in a POSIX compatible fashion
+PATH=$(getconf PATH)
+awk 'BEGIN { srand() ; print srand() }'
diff --git a/man/man1/uts.1df b/man/man1/uts.1df
new file mode 100644
index 00000000..f28797a4
--- /dev/null
+++ b/man/man1/uts.1df
@@ -0,0 +1,16 @@
+.TH UTS 1df "December 2016" "Manual page for uts"
+.SH NAME
+.B uts
+\- prints the current UNIX timestamp
+.SH SYNOPSIS
+.B uts
+.SH DESCRIPTION
+.B uts
+applies POSIX's specifications for the behaviour of its srand() function to
+print the current UNIX timestamp.
+.SH SEE ALSO
+date(1)
+.br
+<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html#tag_20_06_13_12>
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>