lua-users home
lua-l archive

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


On Tue, Oct 11, 2011 at 12:42 PM, Louis Mamakos <louie@transsys.com> wrote:
> How about an API that looked like this:
> seconds, fractional_seconds = foo.time()
> You'd return integer seconds as the first return value, and fractional
> seconds (as a floating point number) as the second result.  Code that was

I prefer to just return the time as a single number, with decimal
precision. lusocket has

 http://sam-github.github.com/luasocket/socket.html#gettime

It has (theoretically) nanosecond resolution on windows, and
millisecond on unix.

And, of course, I wrote my own before noticing that it existed:

https://github.com/sam-github/libnet/blob/master/lua/net.c, lnet_gettimeofday()

I bet luaposix has one, too.

Cheers,
Sam