-inline void SGTimeStamp::stamp() {
-#if defined( WIN32 )
- unsigned int t;
- t = timeGetTime();
- seconds = 0;
- usec = t * 1000;
-#elif defined( HAVE_GETTIMEOFDAY )
- struct timeval current;
- struct timezone tz;
- // sg_timestamp currtime;
- gettimeofday(¤t, &tz);
- seconds = current.tv_sec;
- usec = current.tv_usec;
-#elif defined( HAVE_GETLOCALTIME )
- SYSTEMTIME current;
- GetLocalTime(¤t);
- seconds = current.wSecond;
- usec = current.wMilliseconds * 1000;
-#elif defined( HAVE_FTIME )
- struct timeb current;
- ftime(¤t);
- seconds = current.time;
- usec = current.millitm * 1000;
-// -dw- uses time manager
-#elif defined( macintosh )
- UnsignedWide ms;
- Microseconds(&ms);
-
- seconds = ms.lo / 1000000;
- usec = ms.lo - ( seconds * 1000000 );
-#else
-# error Port me
-#endif
-}
-
-// increment the time stamp by the number of microseconds (usec)
-inline SGTimeStamp operator + (const SGTimeStamp& t, const long& m) {
-#ifdef WIN32
- return SGTimeStamp( 0, t.usec + m );
-#else
- return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000,
- ( t.usec + m ) % 1000000 );
-#endif
-}
-
-// difference between time stamps in microseconds (usec)
-inline long operator - (const SGTimeStamp& a, const SGTimeStamp& b)
-{
-#if defined( WIN32 )
- return a.usec - b.usec;
-#else
- return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec);
-#endif
-}
-