[concurrency-interest] ScheduledThreadPoolExecutor schdeuling problem ?
hanson.char at gmail.com
Mon Dec 31 14:38:42 EST 2007
Oops, not accuracy but precision, as stated in the System.nanoTime javadoc:
"This method provides nanosecond precision, but not necessarily
But still, I would imagine it would costs more to compute the
nano-time than milli-time. I wonder how much more.
On Dec 31, 2007 11:34 AM, Hanson Char <hanson.char at gmail.com> wrote:
> Is it true however that System.nanoTime() incurs more overhead than
> System.currentTimeMillis(), since it has a million time more accuracy
> Hanson Char
> On Dec 31, 2007 11:28 AM, Doug Lea <dl at cs.oswego.edu> wrote:
> > Yes, It is easily possible for nanoTime-based vs currentTimeMillis-based
> > duration estimates to differ once in a while;
> > for example, because the underlying currentTimeMillis
> > system clock is typically updated less frequently.
> > On average they balance out, but
> > if you need consistency across all readings, you should rely on nanoTime.
> > -Doug
More information about the Concurrency-interest