main: Switch to socket.gettime for higher accuracy timestamps in machine-readable logs

Thu, 31 Dec 2015 13:24:41 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 31 Dec 2015 13:24:41 +0000
changeset 61
21871fb2db99
parent 60
e032cdb517ab
child 62
52a24deb0cc3

main: Switch to socket.gettime for higher accuracy timestamps in machine-readable logs

main.lua file | annotate | diff | comparison | revisions
--- a/main.lua	Thu Dec 17 14:25:33 2015 +0000
+++ b/main.lua	Thu Dec 31 13:24:41 2015 +0000
@@ -1,6 +1,7 @@
 #!/usr/bin/env luajit
 
 local json = require "cjson";
+local time = require "socket".gettime;
 
 local result_log_filename = nil;
 local property_rules = {};
@@ -143,7 +144,7 @@
 	result_log = assert(io.open(result_log_filename, "w+"));
 	result_log:write("[\n");
 	function log_data(type, data)
-		local entry = { type = type, data = data, time = os.time() };
+		local entry = { type = type, data = data, time = time() };
 		result_log:write("  ", json.encode(entry), ",\n");
 		result_log:flush();
 	end

mercurial