mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Make task.wait test a bit more lenient
This commit is contained in:
parent
3f5371a7c1
commit
dbf5c989c2
1 changed files with 4 additions and 4 deletions
|
@ -3,9 +3,9 @@ local stdio = require("@lune/stdio")
|
||||||
local task = require("@lune/task")
|
local task = require("@lune/task")
|
||||||
|
|
||||||
-- Wait should be accurate down to at least 10ms
|
-- Wait should be accurate down to at least 10ms
|
||||||
-- on Windows, and 3ms on Linux and / or macOS
|
-- on Windows, and 6ms on Linux and / or macOS
|
||||||
|
|
||||||
local EPSILON = if process.os == "windows" then 10 / 1_000 else 3 / 1_000
|
local EPSILON = if process.os == "windows" then 10 / 1_000 else 6 / 1_000
|
||||||
|
|
||||||
local function test(expected: number)
|
local function test(expected: number)
|
||||||
local start = os.clock()
|
local start = os.clock()
|
||||||
|
@ -43,8 +43,8 @@ local function measure(duration: number)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- About 15ms is usually the shortest sleep time on Windows, but
|
-- About 20ms is the shortest safe sleep time on Windows, but
|
||||||
-- Linux and macOS can usually do down to about 5ms or less
|
-- Linux and macOS can do down to about 10ms or less safely
|
||||||
measure(if process.os == "windows" then 15 / 1_000 else 5 / 1_000)
|
measure(if process.os == "windows" then 15 / 1_000 else 5 / 1_000)
|
||||||
|
|
||||||
measure(1 / 60)
|
measure(1 / 60)
|
||||||
|
|
Loading…
Reference in a new issue