[kaffe] System.currentTimeMillis() buggy?

Adam Heath doogie at brainfood.com
Sun Jan 2 18:55:02 PST 2005


On Sat, 1 Jan 2005, pancake at phreaker.net wrote:

> Try this snipped:
>
>   public static void main (String [] args)
>     {
>         // JIT/hotspot warmup:
>         for (int r = 0; r < 3000; ++ r) System.currentTimeMillis ();
>
>         long time = System.currentTimeMillis (), time_prev = time;
>
>         for (int i = 0; i < 5; ++ i)
>         {
>             // Busy wait until system time changes:
>             while (time == time_prev)
>                 time = System.currentTimeMillis ();
>
>             System.out.println ("delta = " + (time - time_prev) + " ms");
>             time_prev = time;
>         }
>     }
>
> ---
>
> On my box results are:
>
> delta = 1 ms
> delta = 4 ms
> delta = 1 ms
> delta = 1 ms
> delta = 1 ms


Not at all.  What OS?  Is it linux?  Is it 2.6?

2.6 has HZ = 1000.




More information about the kaffe mailing list