/* * * Copyright (c) 1994 * Hewlett-Packard Company * */ #ifndef CLOCK_H #define CLOCK_H extern "C" { #include } class Clock { struct timeval start; struct timeval now; struct timezone tz; public: Clock() {}; void clear(); double time(); }; inline void Clock::clear() { (void) gettimeofday( &start, &tz ); } inline double Clock::time() { (void) gettimeofday( &now, &tz ); return ( double( now.tv_sec - start.tv_sec ) * 1000000 + double( now.tv_usec - start.tv_usec ) ); } #endif