[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: os.clock() always return 0 on Archlinux (a Linode instance)
- From: Johnson Lin <arch.jslin@...>
- Date: Wed, 28 Sep 2011 10:50:45 +0800
On Wed, Sep 28, 2011 at 3:14 AM, David Given <dg@cowlark.com> wrote:
> On 27/09/11 18:01, Peter Cawley wrote:
> [...]
>> os.time - the current time ... or a time representing the date and
>> time specified by the given table
>
> Beware, though --- os.time() has a granularity of seconds, so making it
> tricky to use for benchmarks. Hence my recommendation of
> socket.gettime(), which doesn't.
>
Yeah, this is exactly the dilemma I was facing. And actually quite a few
applications *other than* benckmarking need granularity of milliseconds.
So many things can happen in a second, no? :p
I am happily using socket.gettime() right now, although it felt like this
functionality should resides in os module, IMHO. But, anyway luasocket
is pretty much a must-to-have module. Even Lua on Android has it
as a pre-installed module (the other one being json4lua)
Thanks for all these replies, learned a lot =)
--Johnson