40 #include <sys/timeb.h> 43 # include <sys/time.h> 88 struct _timeb timebuffer;
90 struct timeval a_time;
106 _ftime64_s( &timebuffer );
109 gettimeofday( &a_time,
NULL );
119 return Elapsed( now );
129 return Elapsed_us( now );
138 double seconds = double( other.timebuffer.time - timebuffer.time);
139 double msec = double( other.timebuffer.millitm - timebuffer.millitm );
141 return seconds + msec / 1000.0;
148 long seconds = long( other.timebuffer.time - timebuffer.time);
149 long msec = long( other.timebuffer.millitm - timebuffer.millitm );
151 return seconds * 1000000 + msec * 1000;
158 double seconds = double( other.
a_time.tv_sec - a_time.tv_sec );
159 double usec = double( other.
a_time.tv_usec - a_time.tv_usec );
161 return seconds + usec / 1000000.0;
168 long seconds = other.
a_time.tv_sec - a_time.tv_sec;
169 long usec = other.
a_time.tv_usec - a_time.tv_usec;
171 return seconds * 1000000 + usec;
void StoreNow(void)
Store current time internally.
double Elapsed(void) const
Return time in seconds elapsed between the time stored in the object and now.
long Elapsed_us(cSimpleTime const &other) const
Return time in micro seconds elapsed between the time stored in the object and other.
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
#define NAMESPACE_SDH_START
NAMESPACE_SDH_START typedef time_t tTimevalSec
cSimpleTime()
Constructor: store current time ("now") internally.
#define NAMESPACE_SDH_END
This file contains settings to make the SDHLibrary compile on differen systems:
Very simple class to measure elapsed time.
timeval Timeval(void)
Return the time stored as C struct timeval.
long Elapsed_us(void) const
Return time in micro seconds elapsed between the time stored in the object and now.