]> git.mxchange.org Git - simgear.git/blobdiff - simgear/timing/timestamp.cxx
Merge branch 'next' of git://gitorious.org/fg/simgear into next
[simgear.git] / simgear / timing / timestamp.cxx
index 4d14a42acc16ed733b54b80d3fe76c26bd222383..83eff2fc10ea485c8039634132b958f1ac866cef 100644 (file)
 #include "timestamp.hxx"
 
 void SGTimeStamp::stamp() {
-#if defined( WIN32 ) && !defined(__CYGWIN__)
+#ifdef _WIN32
     unsigned int t;
     t = timeGetTime();
     _sec = t / 1000;
-    _nsec = ( t - ( seconds * 1000 ) ) * 1000 * 1000;
+    _nsec = ( t - ( _sec * 1000 ) ) * 1000 * 1000;
 #elif defined(_POSIX_TIMERS) && (0 < _POSIX_TIMERS)
     struct timespec ts;
 #if defined(_POSIX_MONOTONIC_CLOCK)
@@ -104,3 +104,10 @@ void SGTimeStamp::stamp() {
 #endif
 }
 
+int SGTimeStamp::elapsedMSec() const
+{
+    SGTimeStamp now;
+    now.stamp();
+    
+    return static_cast<int>((now - *this).toMSecs());
+}