#include // Return the current time as a double float in second units double getTimeAsDouble() { struct timeval t; ::gettimeofday( &t, NULL ); return double(t.tv_sec) + double(t.tv_usec)/1000000.0; }