summaryrefslogtreecommitdiff
path: root/rhnop-server/noprml
diff options
context:
space:
mode:
Diffstat (limited to 'rhnop-server/noprml')
-rwxr-xr-xrhnop-server/noprml8
1 files changed, 4 insertions, 4 deletions
diff --git a/rhnop-server/noprml b/rhnop-server/noprml
index 6065948..a763de3 100755
--- a/rhnop-server/noprml
+++ b/rhnop-server/noprml
@@ -27,15 +27,12 @@
local queue_name = "/rhnop"
-require "posix"
-mq = require "mq"
-
-- reading timestamp (milliseconds since epoch)
local p = assert(io.popen("/bin/date --utc '+%s %N'" , 'r'))
local time = assert(p:read('*l'))
p:close()
local s, ns = assert(string.match(time, "([0-9]+) ([0-9]+)"))
-local timestamp = s*1000 + math.floor(ns/1000000)
+local timestamp = s .. string.format("%06d", math.floor(ns/1000))
-- check arguments
if #arg < 4 then
@@ -43,6 +40,9 @@ if #arg < 4 then
os.exit(1)
end
+require "posix"
+mq = require "mq"
+
-- open message queue
posix.umask("rwxrwxr-x")
local q, err = mq.create(queue_name, "wo", "rw-rw----")