[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Time measurement
- From: Shmuel Zeigerman <shmuz@...>
- Date: Tue, 23 Sep 2008 15:16:05 +0300
I have an interactive Lua script that prompts user with a question and
waits for an answer string from the standard input. The script measures
the time it takes user to enter the answer, and the measurement should
have 100 ms accuracy (or better).
Under Windows, it's achieved trivially by calling os.clock twice and
subtracting the first value from the second. However, under Linux, the
function returns 0 both times.
The questions:
1. How can I get time intervals of waiting for keyboard input measured
with the 100 ms accuracy under Linux?
2. Is there a Lua solution to this problem that is portable between (at
least) Linux and Windows?
Thanks.
--
Shmuel