[concurrency-interest] ScheduledThreadPoolExecutor schdeuling problem ?

Hanson Char hanson.char at gmail.com
Mon Dec 31 14:34:51 EST 2007


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 mailing list