moonbridge
changeset 235:6bcdddff1ddd
Added missing documentation for moonbridge_io.timeref(...) function
author | jbe |
---|---|
date | Sat Jan 16 04:37:53 2016 +0100 (2016-01-16) |
parents | e8084e64aa91 |
children | 5f2a2f73e9d3 |
files | reference.txt |
line diff
1.1 --- a/reference.txt Sat Jan 16 04:18:27 2016 +0100 1.2 +++ b/reference.txt Sat Jan 16 04:37:53 2016 +0100 1.3 @@ -424,6 +424,27 @@ 1.4 for moonbridge.io_locallisten(...). 1.5 1.6 1.7 +### moonbridge_io.timeref(previous) 1.8 + 1.9 +Helper function which returns a time reference (in SI-seconds). If a value is 1.10 +passed as an optional argument to the function, then that value is substracted 1.11 +from the result. A common idiom is: 1.12 + 1.13 + local starttime = moonbridge_io.timeref() 1.14 + [...] 1.15 + while true do 1.16 + [...] 1.17 + if not moonbridge_io.poll( 1.18 + input_set, 1.19 + output_set, 1.20 + timeout - moonbridge_io.timeref(starttime) 1.21 + ) then 1.22 + error("Timeout or signal received!") 1.23 + end 1.24 + [...] 1.25 + end 1.26 + 1.27 + 1.28 1.29 HTTP module 1.30 -----------