On 02/08/2012 09:12 PM, Richard Cochran wrote:

I think "resolution" does not mean tick duration, but rather the finest timer 
unit.

#include <stdio.h>
#include <time.h>

int main (int argc, char *argv[])
{
  int i;
  struct timespec rs, ts[10];

  clock_getres (CLOCK_REALTIME, &rs);
  printf ("res: %lus %luns\n", rs.tv_sec, rs.tv_nsec);

  for (i = 0; i < 10; i++)
    clock_gettime (CLOCK_REALTIME, ts + i);
  for (i = 0; i < 10; i++)
    printf ("%d: %lus %luns\n", i, ts[i].tv_sec, ts[i].tv_nsec);

  return 0;
}

=>

res: 0s 10000000ns
0: 1328779203s 975317500ns
1: 1328779203s 975317900ns
2: 1328779203s 975318200ns
3: 1328779203s 975318400ns
4: 1328779203s 975318600ns
5: 1328779203s 975318800ns
6: 1328779203s 975319000ns
7: 1328779203s 975319300ns
8: 1328779203s 975319500ns
9: 1328779203s 975319600ns

Old Sun Fire 880, SunOS 5.10 Generic_139555-08.

100ns precision with 10ms "finest timer unit"???

Dmitry

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to