2 * Sherlock Library -- Execution Timing
4 * (c) 1997 Martin Mares <mj@ucw.cz>
13 static struct timeval last_tv;
21 gettimeofday(&tv, NULL);
22 if (tv.tv_sec < last_tv.tv_sec
23 || tv.tv_sec == last_tv.tv_sec && tv.tv_usec < last_tv.tv_usec)
27 if (tv.tv_sec == last_tv.tv_sec)
28 diff = (tv.tv_usec - last_tv.tv_usec + 500) / 1000;
31 diff = 1000 * (tv.tv_sec - last_tv.tv_sec - 1);
32 diff += (1000500 - last_tv.tv_usec + tv.tv_usec) / 1000;
42 gettimeofday(&last_tv, NULL);