#include /* function to get time in milliseconds since "epoch" */ /* uses Linux library function gettimeofday, so may not be portable */ int get_time() { struct timeval tv; struct timezone tz; if (gettimeofday(&tv, &tz) == 0) return tv.tv_sec * 1000 + (tv.tv_usec + 500) / 1000; else return 0.0; }