[kaffe] System.currentTimeMillis() buggy?

pancake at phreaker.net pancake at phreaker.net
Sat Jan 1 01:32:45 PST 2005


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

... strange :/




More information about the kaffe mailing list