#include #include #include "time_func.h" static TIMESTAMP start_timestamp = 0; TIMESTAMP TimeSinceEpoch(void) { TIMESTAMP rc; struct timeval tv; gettimeofday(&tv, NULL); rc = (tv.tv_sec * (TIMESTAMP)1000) + (tv.tv_usec / (TIMESTAMP)1000); return rc; } TIMESTAMP TimeSinceStart(void) { return TimeSinceEpoch() - start_timestamp; } void TimeInit(void) { start_timestamp = TimeSinceEpoch(); }