Blob Blame History Raw
diff -up SimGear-1.0.0/simgear/props/props.hxx.untangle SimGear-1.0.0/simgear/props/props.hxx
--- SimGear-1.0.0/simgear/props/props.hxx.untangle	2007-11-17 08:35:44.000000000 +0100
+++ SimGear-1.0.0/simgear/props/props.hxx	2008-01-06 16:13:31.000000000 +0100
@@ -17,6 +17,7 @@
 #endif
 
 #include <vector>
+#include <cstdlib>
 
 #if PROPS_STANDALONE
 
@@ -835,7 +836,40 @@ public:
   /**
    * Get a double value for this node.
    */
-  double getDoubleValue () const;
+  double getDoubleValue () const
+  {
+                                  // Shortcut for common case
+    if (_attr == (READ|WRITE) && _type == DOUBLE)
+      return get_double();
+
+    /* Commented to make getDoubleValue() independend if props.obj as
+       getDoubleValue() gets used by structure */
+    /* if (getAttribute(TRACE_READ))
+         trace_read(); */
+    if (!getAttribute(READ))
+      return 0.0L; /* SGRawValue<double>::DefaultValue */
+
+    switch (_type) {
+    case ALIAS:
+      return _value.alias->getDoubleValue();
+    case BOOL:
+      return double(get_bool());
+    case INT:
+      return double(get_int());
+    case LONG:
+      return double(get_long());
+    case FLOAT:
+      return double(get_float());
+    case DOUBLE:
+      return get_double();
+    case STRING:
+    case UNSPECIFIED:
+      return strtod(get_string(), 0);
+    case NONE:
+    default:
+      return 0.0L; /* SGRawValue<double>::DefaultValue */
+    }
+  }
 
 
   /**
@@ -1155,12 +1189,54 @@ protected:
 private:
 
 				// Get the raw value
-  bool get_bool () const;
-  int get_int () const;
-  long get_long () const;
-  float get_float () const;
-  double get_double () const;
-  const char * get_string () const;
+  inline bool get_bool () const
+  {
+    if (_tied)
+      return _value.bool_val->getValue();
+    else
+      return _local_val.bool_val;
+  }
+
+  inline int get_int () const
+  {
+    if (_tied)
+      return _value.int_val->getValue();
+    else
+      return _local_val.int_val;
+  }
+
+  inline long get_long () const
+  {
+    if (_tied)
+      return _value.long_val->getValue();
+    else
+      return _local_val.long_val;
+  }
+
+  inline float get_float () const
+  {
+    if (_tied)
+      return _value.float_val->getValue();
+    else
+      return _local_val.float_val;
+  }
+
+  inline double get_double () const
+  {
+    if (_tied)
+      return _value.double_val->getValue();
+    else
+      return _local_val.double_val;
+  }
+
+  inline const char * get_string () const
+  {
+    if (_tied)
+      return _value.string_val->getValue();
+    else
+      return _local_val.string_val;
+  }
+
 
 				// Set the raw value
   bool set_bool (bool value);
diff -up SimGear-1.0.0/simgear/props/props.cxx.untangle SimGear-1.0.0/simgear/props/props.cxx
--- SimGear-1.0.0/simgear/props/props.cxx.untangle	2007-11-17 08:35:44.000000000 +0100
+++ SimGear-1.0.0/simgear/props/props.cxx	2008-01-06 16:13:31.000000000 +0100
@@ -317,60 +317,6 @@ find_node (SGPropertyNode * current,
 ////////////////////////////////////////////////////////////////////////
 
 inline bool
-SGPropertyNode::get_bool () const
-{
-  if (_tied)
-    return _value.bool_val->getValue();
-  else
-    return _local_val.bool_val;
-}
-
-inline int
-SGPropertyNode::get_int () const
-{
-  if (_tied)
-    return _value.int_val->getValue();
-  else
-    return _local_val.int_val;
-}
-
-inline long
-SGPropertyNode::get_long () const
-{
-  if (_tied)
-    return _value.long_val->getValue();
-  else
-    return _local_val.long_val;
-}
-
-inline float
-SGPropertyNode::get_float () const
-{
-  if (_tied)
-    return _value.float_val->getValue();
-  else
-    return _local_val.float_val;
-}
-
-inline double
-SGPropertyNode::get_double () const
-{
-  if (_tied)
-    return _value.double_val->getValue();
-  else
-    return _local_val.double_val;
-}
-
-inline const char *
-SGPropertyNode::get_string () const
-{
-  if (_tied)
-    return _value.string_val->getValue();
-  else
-    return _local_val.string_val;
-}
-
-inline bool
 SGPropertyNode::set_bool (bool val)
 {
   if (_tied) {
@@ -1173,40 +1119,6 @@ SGPropertyNode::getFloatValue () const
   }
 }
 
-double 
-SGPropertyNode::getDoubleValue () const
-{
-				// Shortcut for common case
-  if (_attr == (READ|WRITE) && _type == DOUBLE)
-    return get_double();
-
-  if (getAttribute(TRACE_READ))
-    trace_read();
-  if (!getAttribute(READ))
-    return SGRawValue<double>::DefaultValue;
-
-  switch (_type) {
-  case ALIAS:
-    return _value.alias->getDoubleValue();
-  case BOOL:
-    return double(get_bool());
-  case INT:
-    return double(get_int());
-  case LONG:
-    return double(get_long());
-  case FLOAT:
-    return double(get_float());
-  case DOUBLE:
-    return get_double();
-  case STRING:
-  case UNSPECIFIED:
-    return strtod(get_string(), 0);
-  case NONE:
-  default:
-    return SGRawValue<double>::DefaultValue;
-  }
-}
-
 const char *
 SGPropertyNode::getStringValue () const
 {
diff -up SimGear-1.0.0/simgear/misc/sg_path.hxx.untangle SimGear-1.0.0/simgear/misc/sg_path.hxx
--- SimGear-1.0.0/simgear/misc/sg_path.hxx.untangle	2006-03-08 19:16:08.000000000 +0100
+++ SimGear-1.0.0/simgear/misc/sg_path.hxx	2008-01-06 16:17:14.000000000 +0100
@@ -34,6 +34,7 @@
 #include STL_STRING
 
 #include <simgear/math/sg_types.hxx>
+#include <simgear/debug/logstream.hxx>
 
 SG_USING_STD(string);
 
@@ -42,6 +43,73 @@ SG_USING_STD(string);
 #endif
 
 /**
+ * define directory path and search separators
+ */
+
+#if defined( macintosh )
+#define SGPATH_sgDirPathSep ':'
+#define SGPATH_sgDirPathSepBad '/'
+#else
+#define SGPATH_sgDirPathSep '/'
+#define SGPATH_sgDirPathSepBad '\\'
+#endif
+
+#if defined( WIN32 ) && !defined(__CYGWIN__)
+#define SGPATH_sgSearchPathSep ';'
+#else
+#define SGPATH_sgSearchPathSep ':'
+#endif
+
+
+/**
+ * Split a directory string into a list of it's parent directories.
+ */
+static inline string_list sgPathBranchSplit( const string &dirpath ) {
+    string_list path_elements;
+    string element, path = dirpath;
+    while ( path.size() ) {
+        size_t p = path.find( SGPATH_sgDirPathSep );
+        if ( p != string::npos ) {
+            element = path.substr( 0, p );
+            path.erase( 0, p + 1 );
+        } else {
+            element = path;
+            path = "";
+        }
+        if ( element.size() )
+            path_elements.push_back( element );
+    }
+    return path_elements;
+}
+
+
+/**
+ * Split a directory search path into a vector of individual paths
+ */
+static inline string_list sgPathSplit( const string &search_path ) {
+    string tmp = search_path;
+    string_list result;
+    result.clear();
+
+    bool done = false;
+
+    while ( !done ) {
+        int index = tmp.find(SGPATH_sgSearchPathSep);
+        if (index >= 0) {
+            result.push_back( tmp.substr(0, index) );
+            tmp = tmp.substr( index + 1 );
+        } else {
+            if ( !tmp.empty() )
+                result.push_back( tmp );
+            done = true;
+        }
+    }
+
+    return result;
+}
+
+
+/**
  * A class to hide path separator difference across platforms and assist
  * in managing file system path names.
  *
@@ -64,10 +132,13 @@ public:
      * Construct a path based on the starting path provided.
      * @param p initial path
      */
-    SGPath( const string& p );
+    SGPath( const string& p ) : path(p)
+    {
+        fix();
+    }
 
     /** Destructor */
-    ~SGPath();
+    ~SGPath() {}
 
     /**
      * Set path to a new value
@@ -80,7 +151,17 @@ public:
      * Append another piece to the existing path.  Inserts a path
      * separator between the existing component and the new component.
      * @param p additional path component */
-    void append( const string& p );
+    void append( const string& p ) {
+        if ( path.size() == 0 ) {
+            path = p;
+        } else {
+            if ( p[0] != SGPATH_sgDirPathSep ) {
+                path += SGPATH_sgDirPathSep;
+            }
+            path += p;
+        }
+        fix();
+    }
 
     /**
      * Append a new piece to the existing path.  Inserts a search path
@@ -93,7 +174,14 @@ public:
      * path separator.
      * @param p addtional path suffix
      */
-    void concat( const string& p );
+    void concat( const string& p ) {
+        if ( path.size() == 0 ) {
+            path = p;
+        } else {
+            path += p;
+        }
+        fix();
+    }
 
     /**
      * Get the file part of the path (everything after the last path sep)
@@ -105,7 +193,14 @@ public:
      * Get the directory part of the path.
      * @return directory string
      */
-    string dir() const;
+    string dir() const {
+        int index = path.rfind(SGPATH_sgDirPathSep);
+        if (index >= 0) {
+            return path.substr(0, index);
+        } else {
+            return "";
+        }
+    }
   
     /**
      * Get the base part of the path (everything but the extension.)
@@ -140,26 +235,75 @@ public:
     /**
      * Create the designated directory.
      */
-    void create_dir(mode_t mode);
+    void create_dir(mode_t mode)
+    {
+        string_list dirlist = sgPathSplit(dir());
+        if ( dirlist.empty() )
+            return;
+        string path = dirlist[0];
+        string_list path_elements = sgPathBranchSplit(path);
+        bool absolute = !path.empty() && path[0] == SGPATH_sgDirPathSep;
+
+        unsigned int i = 1;
+        SGPath dir = absolute ? string( 1, SGPATH_sgDirPathSep ) : "";
+        dir.concat( path_elements[0] );
+    #if defined( _MSC_VER) || defined(__MINGW32__)
+        if ( dir.str().find(':') != string::npos && path_elements.size() >= 2 ) {
+            dir.append( path_elements[1] );
+            i = 2;
+        }
+    #endif
+        struct stat info;
+        int r;
+        for(; ( r = stat( dir.c_str(), &info ) ) == 0 && i < path_elements.size(); i++) {
+            dir.append(path_elements[i]);
+        }
+        if ( r == 0 ) {
+            return; // Directory already exists
+        }
+        #if defined( _MSC_VER) || defined(__MINGW32__)
+        #  define sgMkDir(d,m)       _mkdir(d)
+        #else
+        #  define sgMkDir(d,m)       mkdir(d,m)
+        #endif
+        if ( sgMkDir( dir.c_str(), mode) ) {
+            SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
+            return;
+        }
+        for(;i < path_elements.size(); i++) {
+            dir.append(path_elements[i]);
+            if ( sgMkDir( dir.c_str(), mode) ) {
+                SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
+                break;
+            }
+        }
+        #undef sgMkDir
+    }
 
 private:
 
-    void fix();
+    // If Unix, replace all ":" with "/".  If MacOS, replace all "/" with
+    // ":" it should go without saying that neither of these characters
+    // should be used in file or directory names.  In windoze, allow the
+    // second character to be a ":" for things like c:\foo\bar
+
+    void fix()
+    {
+        for ( string::size_type i = 0; i < path.size(); ++i ) {
+    #if defined( WIN32 )
+            // for windoze, don't replace the ":" for the second character
+            if ( i == 1 ) {
+                continue;
+            }
+    #endif
+            if ( path[i] == SGPATH_sgDirPathSepBad ) {
+                path[i] = SGPATH_sgDirPathSep;
+            }
+        }
+    }
 
 };
 
-
-/**
- * Split a directory string into a list of it's parent directories.
- */
-string_list sgPathBranchSplit( const string &path );
-
-/**
- * Split a directory search path into a vector of individual paths
- */
-string_list sgPathSplit( const string &search_path );
-
-
 #endif // _SG_PATH_HXX
 
 
diff -up SimGear-1.0.0/simgear/misc/sg_path.cxx.untangle SimGear-1.0.0/simgear/misc/sg_path.cxx
--- SimGear-1.0.0/simgear/misc/sg_path.cxx.untangle	2007-11-17 08:35:44.000000000 +0100
+++ SimGear-1.0.0/simgear/misc/sg_path.cxx	2008-01-06 16:13:31.000000000 +0100
@@ -35,47 +35,6 @@
 #include "sg_path.hxx"
 
 
-/**
- * define directory path separators
- */
-
-#if defined( macintosh )
-static const char sgDirPathSep = ':';
-static const char sgDirPathSepBad = '/';
-#else
-static const char sgDirPathSep = '/';
-static const char sgDirPathSepBad = '\\';
-#endif
-
-#if defined( WIN32 ) && !defined(__CYGWIN__)
-static const char sgSearchPathSep = ';';
-#else
-static const char sgSearchPathSep = ':';
-#endif
-
-
-// If Unix, replace all ":" with "/".  If MacOS, replace all "/" with
-// ":" it should go without saying that neither of these characters
-// should be used in file or directory names.  In windoze, allow the
-// second character to be a ":" for things like c:\foo\bar
-
-void
-SGPath::fix()
-{
-    for ( string::size_type i = 0; i < path.size(); ++i ) {
-#if defined( WIN32 )
-	// for windoze, don't replace the ":" for the second character
-	if ( i == 1 ) {
-	    continue;
-	}
-#endif
-	if ( path[i] == sgDirPathSepBad ) {
-	    path[i] = sgDirPathSep;
-	}
-    }
-}
-
-
 // default constructor
 SGPath::SGPath()
     : path("")
@@ -83,19 +42,6 @@ SGPath::SGPath()
 }
 
 
-// create a path based on "path"
-SGPath::SGPath( const std::string& p )
-    : path(p)
-{
-    fix();
-}
-
-
-// destructor
-SGPath::~SGPath() {
-}
-
-
 // set path
 void SGPath::set( const string& p ) {
     path = p;
@@ -103,40 +49,15 @@ void SGPath::set( const string& p ) {
 }
 
 
-// append another piece to the existing path
-void SGPath::append( const string& p ) {
-    if ( path.size() == 0 ) {
-	path = p;
-    } else {
-	if ( p[0] != sgDirPathSep ) {
-	    path += sgDirPathSep;
-	}
-	path += p;
-    }
-    fix();
-}
-
 //add a new path component to the existing path string
 void SGPath::add( const string& p ) {
-    append( sgSearchPathSep+p );
-}
-
-
-// concatenate a string to the end of the path without inserting a
-// path separator
-void SGPath::concat( const string& p ) {
-    if ( path.size() == 0 ) {
-	path = p;
-    } else {
-	path += p;
-    }
-    fix();
+    append( SGPATH_sgSearchPathSep+p );
 }
 
 
 // Get the file part of the path (everything after the last path sep)
 string SGPath::file() const {
-    int index = path.rfind(sgDirPathSep);
+    int index = path.rfind(SGPATH_sgDirPathSep);
     if (index >= 0) {
 	return path.substr(index + 1);
     } else {
@@ -145,16 +66,6 @@ string SGPath::file() const {
 }
   
 
-// get the directory part of the path.
-string SGPath::dir() const {
-    int index = path.rfind(sgDirPathSep);
-    if (index >= 0) {
-	return path.substr(0, index);
-    } else {
-	return "";
-    }
-}
-
 // get the base part of the path (everything but the extension.)
 string SGPath::base() const {
     int index = path.rfind(".");
@@ -185,89 +96,3 @@ bool SGPath::exists() const {
     fclose(fp);
     return true;
 }
-
-#if defined( _MSC_VER) || defined(__MINGW32__)
-#  define sgMkDir(d,m)       _mkdir(d)
-#else
-#  define sgMkDir(d,m)       mkdir(d,m)
-#endif
-
-
-void SGPath::create_dir( mode_t mode ) {
-    string_list dirlist = sgPathSplit(dir());
-    if ( dirlist.empty() )
-        return;
-    string path = dirlist[0];
-    string_list path_elements = sgPathBranchSplit(path);
-    bool absolute = !path.empty() && path[0] == sgDirPathSep;
-
-    unsigned int i = 1;
-    SGPath dir = absolute ? string( 1, sgDirPathSep ) : "";
-    dir.concat( path_elements[0] );
-#if defined( _MSC_VER) || defined(__MINGW32__)
-    if ( dir.str().find(':') != string::npos && path_elements.size() >= 2 ) {
-        dir.append( path_elements[1] );
-        i = 2;
-    }
-#endif
-    struct stat info;
-    int r;
-    for(; ( r = stat( dir.c_str(), &info ) ) == 0 && i < path_elements.size(); i++) {
-        dir.append(path_elements[i]);
-    }
-    if ( r == 0 ) {
-        return; // Directory already exists
-    }
-    if ( sgMkDir( dir.c_str(), mode) ) {
-        SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
-        return;
-    }
-    for(;i < path_elements.size(); i++) {
-        dir.append(path_elements[i]);
-        if ( sgMkDir( dir.c_str(), mode) ) {
-            SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
-            break;
-        }
-    }
-}
-
-string_list sgPathBranchSplit( const string &dirpath ) {
-    string_list path_elements;
-    string element, path = dirpath;
-    while ( path.size() ) {
-        size_t p = path.find( sgDirPathSep );
-        if ( p != string::npos ) {
-            element = path.substr( 0, p );
-            path.erase( 0, p + 1 );
-        } else {
-            element = path;
-            path = "";
-        }
-        if ( element.size() )
-            path_elements.push_back( element );
-    }
-    return path_elements;
-}
-
-
-string_list sgPathSplit( const string &search_path ) {
-    string tmp = search_path;
-    string_list result;
-    result.clear();
-
-    bool done = false;
-
-    while ( !done ) {
-        int index = tmp.find(sgSearchPathSep);
-        if (index >= 0) {
-            result.push_back( tmp.substr(0, index) );
-            tmp = tmp.substr( index + 1 );
-        } else {
-            if ( !tmp.empty() )
-                result.push_back( tmp );
-            done = true;
-        }
-    }
-
-    return result;
-}
diff -up SimGear-1.0.0/simgear/timing/timestamp.cxx.untangle SimGear-1.0.0/simgear/timing/timestamp.cxx
--- SimGear-1.0.0/simgear/timing/timestamp.cxx.untangle	2006-08-31 20:26:45.000000000 +0200
+++ SimGear-1.0.0/simgear/timing/timestamp.cxx	2008-01-06 16:13:31.000000000 +0100
@@ -23,94 +23,6 @@
 //
 // $Id: timestamp.cxx,v 1.6 2006-08-31 18:26:45 fredb Exp $
 
-
-#ifdef HAVE_CONFIG_H
-#  include <simgear_config.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include <simgear/compiler.h>
-
-#ifdef SG_HAVE_STD_INCLUDES
-#  include <ctime>
-#else
-#  include <time.h>
-#endif
-
-#ifdef HAVE_SYS_TIMEB_H
-#  include <sys/timeb.h> // for ftime() and struct timeb
-#endif
-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>    // for gettimeofday()
-#endif
-#ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>  // for get/setitimer, gettimeofday, struct timeval
-#endif
-
-// -dw- want to use metrowerks time.h
-#ifdef macintosh
-#  include <time.h>
-#  include <timer.h>
-#endif
-
-#ifdef WIN32
-#  include <windows.h>
-#  if defined( __CYGWIN__ ) || defined( __CYGWIN32__ )
-#    define NEAR /* */
-#    define FAR  /* */
-#  endif
-#  include <mmsystem.h>
-#endif
+// empty, all inline class now.
 
 #include "timestamp.hxx"
-
-
-void SGTimeStamp::stamp() {
-#if defined( WIN32 ) && !defined(__CYGWIN__)
-    unsigned int t;
-    t = timeGetTime();
-    seconds = t / 1000;
-    usec = ( t - ( seconds * 1000 ) ) * 1000;
-#elif defined( HAVE_GETTIMEOFDAY )
-    struct timeval current;
-    struct timezone tz;
-    // sg_timestamp currtime;
-    gettimeofday(&current, &tz);
-    seconds = current.tv_sec;
-    usec = current.tv_usec;
-#elif defined( HAVE_GETLOCALTIME )
-    SYSTEMTIME current;
-    GetLocalTime(&current);
-    seconds = current.wSecond;
-    usec = current.wMilliseconds * 1000;
-#elif defined( HAVE_FTIME )
-    struct timeb current;
-    ftime(&current);
-    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)
-SGTimeStamp operator + (const SGTimeStamp& t, const long& m) {
-    return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000,
-			( t.usec + m ) % 1000000 );
-}
-
-// difference between time stamps in microseconds (usec)
-long operator - (const SGTimeStamp& a, const SGTimeStamp& b)
-{
-    return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec);
-}
diff -up SimGear-1.0.0/simgear/timing/timestamp.hxx.untangle SimGear-1.0.0/simgear/timing/timestamp.hxx
--- SimGear-1.0.0/simgear/timing/timestamp.hxx.untangle	2007-11-17 08:35:45.000000000 +0100
+++ SimGear-1.0.0/simgear/timing/timestamp.hxx	2008-01-06 16:13:31.000000000 +0100
@@ -32,9 +32,47 @@
 # error This library requires C++
 #endif
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
+#ifdef HAVE_WINDOWS_H
+#  include <windows.h>
+#endif
 
 #include <simgear/compiler.h>
 
+#ifdef SG_HAVE_STD_INCLUDES
+#  include <ctime>
+#else
+#  include <time.h>
+#endif
+
+#ifdef HAVE_SYS_TIMEB_H
+#  include <sys/timeb.h> // for ftime() and struct timeb
+#endif
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>    // for gettimeofday()
+#endif
+#ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>  // for get/setitimer, gettimeofday, struct timeval
+#endif
+
+// -dw- want to use metrowerks time.h
+#ifdef macintosh
+#  include <time.h>
+#  include <timer.h>
+#endif
+
+#ifdef WIN32
+#  include <windows.h>
+#  if defined( __CYGWIN__ ) || defined( __CYGWIN32__ )
+#    define NEAR /* */
+#    define FAR  /* */
+#  endif
+#  include <mmsystem.h>
+#endif
+
 
 // MSVC++ 6.0 kuldge - Need forward declaration of friends.
 class SGTimeStamp;
@@ -123,6 +161,52 @@ inline SGTimeStamp& SGTimeStamp::operato
     return *this;
 }
 
+inline void SGTimeStamp::stamp() {
+#if defined( WIN32 ) && !defined(__CYGWIN__)
+    unsigned int t;
+    t = timeGetTime();
+    seconds = t / 1000;
+    usec = ( t - ( seconds * 1000 ) ) * 1000;
+#elif defined( HAVE_GETTIMEOFDAY )
+    struct timeval current;
+    struct timezone tz;
+    // sg_timestamp currtime;
+    gettimeofday(&current, &tz);
+    seconds = current.tv_sec;
+    usec = current.tv_usec;
+#elif defined( HAVE_GETLOCALTIME )
+    SYSTEMTIME current;
+    GetLocalTime(&current);
+    seconds = current.wSecond;
+    usec = current.wMilliseconds * 1000;
+#elif defined( HAVE_FTIME )
+    struct timeb current;
+    ftime(&current);
+    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) {
+    return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000,
+			( t.usec + m ) % 1000000 );
+}
+
+// difference between time stamps in microseconds (usec)
+inline long operator - (const SGTimeStamp& a, const SGTimeStamp& b)
+{
+    return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec);
+}
 
 #endif // _TIMESTAMP_HXX