aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/time_spec.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/time_spec.lua b/spec/time_spec.lua
index 8bee5f7..c9d3d6d 100644
--- a/spec/time_spec.lua
+++ b/spec/time_spec.lua
@@ -2,7 +2,14 @@ local system = require 'system.core'
2 2
3describe('Test time functions', function() 3describe('Test time functions', function()
4 it('gettime returns current time', function() 4 it('gettime returns current time', function()
5 assert.is_near(os.time(), system.gettime(), 1.0) 5 local starttime = system.gettime()
6 local expected = os.time()
7 local endtime = system.gettime()
8 local delta = endtime - starttime
9 local avg = starttime + delta/2
10 assert.is_true(expected >= math.floor(starttime))
11 assert.is_true(expected <= math.ceil(endtime))
12 assert.is_near(expected, avg, 1 + delta)
6 end) 13 end)
7 14
8 it('sleep will wait for specified amount of time', function() 15 it('sleep will wait for specified amount of time', function()