code_analyzer/src/letemps.c
2022-01-08 13:54:02 +01:00

24 lines
489 B
C

/* letemps.c --
* Fares Belhadj -
* amsi@ai.univ-paris8.fr
* 03/11/2004
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include "letemps.h"
static struct timeval ti;
extern void initTemps(void) {
gettimeofday(&ti, (struct timezone*) 0);
}
double getTemps(void) {
struct timeval t;
double diff;
gettimeofday(&t, (struct timezone*) 0);
diff = (t.tv_sec - ti.tv_sec) * 1000000
+ (t.tv_usec - ti.tv_usec);
return diff/1000000.;
}