lua-users home
lua-l archive

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


>These might be deceiving. 
>The count returned might be in 1000 ticks per second, but 
>the actual resolution might be way less than that.
>
>Vincent Penquerc'h     

You are right. I wrote this to check it out:

  for (int i = 0; i < 100; i++) {
    printf("%ld, ", clock());
  }

The result (Borland C++ Builder 3, Windows 98) on my machine is:

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
18, 18, 18, 18, 18, 18, 18, 18,

So the actual resolution seems to be approx. 2 ms, unless I am mistaken.

  Enrico