aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2016-06-28 14:49:44 +0100
committerMatthew Wild <mwild1@gmail.com>2016-06-28 14:49:44 +0100
commit8afacb5d92d6098f6eb85bbc32aff5632983bd5d (patch)
tree70075a9795190bc0cd62e2e885a4be2ad1ab80a3
parent8d589c476873ff77027c2f64840afaff70422d1c (diff)
downloadprosody-8afacb5d92d6098f6eb85bbc32aff5632983bd5d.tar.gz
prosody-8afacb5d92d6098f6eb85bbc32aff5632983bd5d.zip
util.time: New tiny library to abstract LuaSocket's gettime() function, so we can use other sources in the future
-rw-r--r--util/time.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/time.lua b/util/time.lua
new file mode 100644
index 00000000..84cff877
--- /dev/null
+++ b/util/time.lua
@@ -0,0 +1,8 @@
+-- Import gettime() from LuaSocket, as a way to access high-resolution time
+-- in a platform-independent way
+
+local socket_gettime = require "socket".gettime;
+
+return {
+ now = socket_gettime;
+}