]> johannes.truschnigg.info Git - netconsole-rx/commitdiff
isoutctime: emit milliseconds
authorJohannes Truschnigg <johannes@truschnigg.info>
Wed, 12 Jul 2023 16:58:56 +0000 (18:58 +0200)
committerJohannes Truschnigg <johannes@truschnigg.info>
Wed, 12 Jul 2023 16:58:56 +0000 (18:58 +0200)
netconsole-rx.lua

index 6753771e93c527f7acbf69185713838dd1335af8..d16d9ba51594bea2295689711161684c2b21c4e1 100755 (executable)
@@ -19,6 +19,12 @@ local socket = require("socket")
 local udpl = assert(socket.udp())
 
 
+function isoutctime()
+  local ts = socket.gettime()
+  return string.format("%s.%03.0f+00:00", os.date("!%Y-%m-%dT%T", ts), math.min(999, (ts % 1) * 1000))
+end
+
+
 function getpid()
   local line
   statfp = io.open("/proc/self/stat", "r")
@@ -83,11 +89,6 @@ function args_validate()
 end
 
 
-function isoutctime()
-  return os.date("!%Y-%m-%dT%TZ")
-end
-
-
 -- init --
 
 mypid = getpid()