1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-27 09:59:04 +00:00

Add nmap.clock() for providing scripts with the current time in floating

point seconds since the epoch, and add clock_ms() and clock_us() to stdnse
for convenience (millisecond and microsecond).

qscan.nse now provides microsecond resolution.
This commit is contained in:
kris
2010-07-23 19:49:42 +00:00
parent 33845f104c
commit cc33a59ca4
6 changed files with 53 additions and 16 deletions

View File

@@ -389,6 +389,18 @@ function format_difftime(t2, t1)
return sign .. s
end
--- Returns the current time in milliseconds since the epoch
-- @return The current time in milliseconds since the epoch
function clock_ms()
return nmap.clock() * 1000
end
--- Returns the current time in microseconds since the epoch
-- @return The current time in microseconds since the epoch
function clock_us()
return nmap.clock() * 1000000
end
---Get the indentation symbols at a given level.
local function format_get_indent(indent, at_end)
local str = ""