You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2005/05/27 01:09:13 UTC

svn commit: r178708 - /xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp

Author: jberry
Date: Thu May 26 16:09:11 2005
New Revision: 178708

URL: http://svn.apache.org/viewcvs?rev=178708&view=rev
Log:
Test with gettimeofday

Modified:
    xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp

Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp?rev=178708&r1=178707&r2=178708&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp Thu May 26 16:09:11 2005
@@ -27,7 +27,8 @@
 
 // *** TODO: protect and x-platform
 #include <limits.h>
-#include <sys/timeb.h>
+// #include <sys/timeb.h>
+#include <sys/time.h>
 
 #include <xercesc/util/Mutexes.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
@@ -628,11 +629,20 @@
 // ---------------------------------------------------------------------------
 unsigned long XMLPlatformUtils::getCurrentMillis()
 {
-	// *** TODO: per platform support here
-    timeb aTime;
+	unsigned long ms = 0;
+	
+	// *** TODO: autoconf checks and additional platform support?
+#if 0
+	timeb aTime;
     ftime(&aTime);
-    return (unsigned long)(aTime.time*1000 + aTime.millitm);
+    ms = (unsigned long)(aTime.time*1000 + aTime.millitm);
+#else
+    struct timeval aTime;
+    gettimeofday(&aTime, NULL);
+    ms = (unsigned long) (aTime.tv_sec * 1000 + aTime.tv_usec / 1000);
+#endif
 
+	return ms;
 }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org