lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

The POSIX standard specifies os.clock() returning CPU time used. But microsoft POSIX library os.clock() returns wall time elapsed since the process started. You'd better avoid using it when your lua code is supposed to run both on Windows and Linux. We learned this a hard way.


Asko Kauppi 写道:

Notice that the value returned by os.clock() is:

".. approximation of the amount in seconds of CPU time used by the program."

It is not the "wall clock" time. If you need that in ms, you need to use LuaSocket, Lanes or some other C side binding to gettimeofday (2) on Posix and similar Win32 API.


spir kirjoitti 13.11.2009 kello 14:37:

Hello again,

Is there a builtin or a lib tool? If not, how do you do it?
(googling brought no sensible info on the topic)

Thank you,
* la vita e estrany *