5
/* $Id: timer.c,v 1.3 2004-04-09 22:03:51 manoj Exp $ */
7
static double msec; /* reference for timer */
10
# include <sys/types.h>
11
# include <sys/time.h>
12
static unsigned firstsec=0; /* Reference for timer */
13
static unsigned firstusec=0; /* Reference for timer */
15
static int first_call=1;
20
double t0 = (double)GetCurrentTime();
22
first_call=0; msec=t0; return 0.0;
25
if(t0<0.0)t0 += (double)0xffffffff;
31
(void) gettimeofday(&tp,&tzp);
35
firstusec = tp.tv_usec;
38
low = (double)(tp.tv_usec>>1) - (double) (firstusec>>1);
39
high = (double) (tp.tv_sec - firstsec);
40
return high + 1.0e-6*(low+low);