diff --git a/src/misc/misc_time.c b/src/misc/misc_time.c index 2dcf2dd51..9b156fc89 100644 --- a/src/misc/misc_time.c +++ b/src/misc/misc_time.c @@ -43,6 +43,27 @@ datestring(void) #endif } +/* return time interval in seconds and milliseconds */ + +#ifdef HAVE_FTIME + +struct timeb timebegin; + +void timediff(struct timeb *now, struct timeb *begin, int *sec, int *msec) +{ + + *msec = (int) now->millitm - (int) begin->millitm; + *sec = (int) now->time - (int) begin->time; + if (*msec < 0) { + *msec += 1000; + (*sec)--; + } + return; + +} + +#endif + /* * How many seconds have elapsed in running time. * This is the routine called in IFseconds diff --git a/src/misc/misc_time.h b/src/misc/misc_time.h index a9fb85029..7c99ad9ce 100644 --- a/src/misc/misc_time.h +++ b/src/misc/misc_time.h @@ -18,4 +18,12 @@ void perf_timer_start(PerfTimer *); void perf_timer_stop(PerfTimer *); void perf_timer_elapsed_sec_ms(const PerfTimer *, int *, int *); +#ifdef HAVE_FTIME + +extern struct timeb timebegin; + +void timediff(struct timeb *, struct timeb *, int *, int *); + +#endif + #endif