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
commit6fc4ad3aefeab816af4b13df7d877386958a510f (patch)
tree70075a9795190bc0cd62e2e885a4be2ad1ab80a3
parent03e138c59a2b3b26c9900f49f04c75bc4f203c53 (diff)
downloadprosody-6fc4ad3aefeab816af4b13df7d877386958a510f.tar.gz
prosody-6fc4ad3aefeab816af4b13df7d877386958a510f.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;
+}