lua-users home
lua-l archive

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


On Wed, Jun 15, 2005 at 10:18:22AM -0700, Chris Marrin wrote:
> Yes, the value in the counter is from when the CPU started. I used the 
> trick of subtracting off the value of the counter when the CPU started. 
> But even with this, 4 hours to millisecond resolution is not acceptable 
> in our app!

For many uses, you only need to measure time from one event to the next;
eg. from the start of a function or loop to the end.  In that case, you
can often just take the difference, which avoids all long-running problems.
(If the timer runs for a long time, fine accuracy usually becomes
irrelevant.)

However, all of this goes away if you avoid floating-point entirely.

(Of course, you can't do that inside Lua--a serious flaw, in my opinion--but
that doesn't seem to be an issue here.)

-- 
Glenn Maynard