aboutsummaryrefslogtreecommitdiff
path: root/lib/datetime.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/datetime.sh')
-rw-r--r--lib/datetime.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/datetime.sh b/lib/datetime.sh
new file mode 100644
index 0000000..7f67a49
--- /dev/null
+++ b/lib/datetime.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# date_iso_utc
+date_now_iso_utc() {
+ TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ"
+}
+
+posix_time_microseconds() {
+ bc -e "($(perl -MTime::HiRes=gettimeofday -MPOSIX=strftime -e '($s,$us) = gettimeofday(); printf "%d.%06d\n", $s, $us') * 1000)" | cut -d '.' -f 1
+}