29enum { USEC = 1000000 };
33inline void NormalizeTime(timeval &in)
35 while (in.tv_usec >= USEC)
41 while (in.tv_usec < 0)
51inline void TimeDif(
const struct timeval &start,
const struct timeval &fin,
struct timeval &answer)
53 answer.tv_usec = fin.tv_usec - start.tv_usec;
54 answer.tv_sec = fin.tv_sec - start.tv_sec;
55 NormalizeTime(answer);
60inline void TimeAdd(
const struct timeval &start,
const struct timeval &delta,
struct timeval &answer)
62 answer.tv_usec = start.tv_usec + delta.tv_usec;
63 answer.tv_sec = start.tv_sec + delta.tv_sec;
64 NormalizeTime(answer);
73inline int gettimeofday(
struct timeval *tv,
void * trash)
77 tv->tv_sec = (long)timeb.time;
78 tv->tv_usec = (
unsigned int)timeb.millitm * 1000;
83#include "time_clock.h"
85#include "time_general.h"