2 * UCW Library -- Execution Timing
4 * (c) 1997 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
16 static struct timeval last_tv;
24 gettimeofday(&tv, NULL);
25 if (tv.tv_sec < last_tv.tv_sec
26 || tv.tv_sec == last_tv.tv_sec && tv.tv_usec < last_tv.tv_usec)
30 if (tv.tv_sec == last_tv.tv_sec)
31 diff = (tv.tv_usec - last_tv.tv_usec + 500) / 1000;
34 diff = 1000 * (tv.tv_sec - last_tv.tv_sec - 1);
35 diff += (1000500 - last_tv.tv_usec + tv.tv_usec) / 1000;
45 gettimeofday(&last_tv, NULL);
49 get_last_timeval(struct timeval *tv)