[time] Fix typos in documentation

This commit is contained in:
zwim
2024-06-17 16:03:48 +02:00
committed by GitHub
parent 16fcc38a3a
commit 43c9ce4a9b

View File

@@ -77,9 +77,9 @@ All other time variables (a handful) get the appropriate suffix `_ms`, `_us`, `_
local start_time = time.now()
-- Do some stuff.
-- You can add and subtract `fts times` objects.
local duration = time.now() - start.fts
-- And convert that object to various more human-readable formats, e.g.,
-- You can add and subtract `fts times` objects
local duration = time.now() - start_time
-- and convert that object to various more human-readable formats, e.g.,
print(string.format("Stuff took %.3fms", time.to_ms(duration)))
local offset = time.s(100)
@@ -107,25 +107,25 @@ local FTS2US = 1 / US2FTS
-- Fixed point time
local time = {}
--- Sometimes we need a very large time
--- Sometimes we need a very large time.
time.huge = math.huge
--- Creates a time (fts) from a number in seconds
--- Creates a time (fts) from a number in seconds.
function time.s(seconds)
return math.floor(seconds * S2FTS)
end
--- Creates a time (fts) from a number in milliseconds
--- Creates a time (fts) from a number in milliseconds.
function time.ms(msec)
return math.floor(msec * MS2FTS)
end
--- Creates a time (fts) from a number in microseconds
--- Creates a time (fts) from a number in microseconds.
function time.us(usec)
return math.floor(usec * US2FTS)
end
--- Creates a time (fts) from a structure similar to timeval
--- Creates a time (fts) from a structure similar to timeval.
function time.timeval(tv)
return tv.sec * S2FTS + tv.usec * US2FTS
end
@@ -159,7 +159,7 @@ end
--[[-- Compare a past *MONOTONIC* fts time to *now*, returning the elapsed time between the two. (sec.usecs variant)
Returns a Lua (decimal) number (sec.usecs, with decimal places) (accurate to the µs)
Returns a Lua (decimal) number (sec.usecs, with decimal places) (accurate to the µs).
]]
function time.since(start_time)
-- Time difference