]> gcc.gnu.org Git - gcc.git/commitdiff
win32.cc (_Jv_platform_gettimeofday): Now takes no args, returns jlong.
authorAdam Megacz <adam@xwt.org>
Fri, 8 Mar 2002 01:03:56 +0000 (01:03 +0000)
committerAdam Megacz <megacz@gcc.gnu.org>
Fri, 8 Mar 2002 01:03:56 +0000 (01:03 +0000)
2002-03-07  Adam Megacz  <adam@xwt.org>

        * win32.cc (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong. Added implementation
        * posix.cc (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong.
        * win32.h (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong.
        * posix.h (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong.
        * java/lang/natSystem.cc (currentTimeMillis): Now uses updated
        _Jv_platform_gettimeofday signature.

From-SVN: r50416

libjava/ChangeLog
libjava/include/posix.h
libjava/include/win32.h
libjava/java/lang/natSystem.cc
libjava/posix.cc
libjava/win32.cc

index ef0022ec32b5dade0c1ac898ebf472adc956d1e4..7c125415ca9d85f0450f277e224fa52c94481a6f 100644 (file)
@@ -1,3 +1,16 @@
+2002-03-07  Adam Megacz  <adam@xwt.org>
+
+        * win32.cc (_Jv_platform_gettimeofday): Now takes no args,
+        returns jlong. Added implementation
+        * posix.cc (_Jv_platform_gettimeofday): Now takes no args,
+        returns jlong.
+        * win32.h (_Jv_platform_gettimeofday): Now takes no args,
+        returns jlong.
+        * posix.h (_Jv_platform_gettimeofday): Now takes no args,
+        returns jlong.
+        * java/lang/natSystem.cc (currentTimeMillis): Now uses updated
+        _Jv_platform_gettimeofday signature.
+       
 2002-03-07  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
 
        * java/net/natPlainSocketImpl.cc (_Jv_recv): Removed.
index bbfb0b244e7fb3e649049a83050000ffef286aad..f96507405de6eccfc472f3a620f1996dc9213386 100644 (file)
@@ -28,6 +28,13 @@ details.  */
 #include <unistd.h>
 #endif
 
+#include <gcj/cni.h>
+
 extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
-extern void _Jv_platform_gettimeofday (struct timeval *);
+extern jlong _Jv_platform_gettimeofday ();
 extern void _Jv_platform_initialize (void);
+
+
+
+
+
index 15b9ffcc7b1d95484c33c368b66b07e6ffa26dee..c2ecbff1ff2cb678f3ece46ce153c489af6eb9bd 100644 (file)
@@ -16,8 +16,9 @@ details.  */
 
 #undef __INSIDE_CYGWIN__
 #include <winsock.h>
+#include <gcj/cni.h>
 
 extern void _Jv_platform_initialize (void);
-extern void _Jv_platform_gettimeofday (struct timeval *);
+extern jlong _Jv_platform_gettimeofday ();
 
 #endif /* __JV_WIN32_H__ */
index c87168d98f81be96ee6a668a142d9e6b56a78049..e8c0572a68d62f3713f5d826a3c2d9a2e487ca8f 100644 (file)
@@ -158,9 +158,7 @@ java::lang::System::arraycopy (jobject src, jint src_offset,
 jlong
 java::lang::System::currentTimeMillis (void)
 {
-  struct timeval tv;
-  _Jv_platform_gettimeofday (&tv);
-  return (jlong) tv.tv_sec * 1000 + tv.tv_usec / 1000;
+  return _Jv_platform_gettimeofday ();
 }
 
 jint
index 66443d21e11599744e8cb1864f5da548b44e088e..56241d241d15e045150eb0841a6554a1ec89c023 100644 (file)
@@ -24,27 +24,25 @@ extern "C" unsigned long long _clock (void);
 #endif
 
 // gettimeofday implementation.
-void
-_Jv_platform_gettimeofday (struct timeval *tv)
+jlong
+_Jv_platform_gettimeofday ()
 {
 #if defined (HAVE_GETTIMEOFDAY)
-  gettimeofday (tv, NULL);
+  timeval tv;
+  gettimeofday (&tv, NULL);
+  return tv.tv_sec * 1000 + tv.tv_usec / 1000;
 #elif defined (HAVE_TIME)
-  tv->tv_sec = time (NULL);
-  tv->tv_usec = 0;
+  return time (NULL) * 1000;
 #elif defined (HAVE_FTIME)
   struct timeb t;
   ftime (&t);
-  tv->tv_sec = t.time;
-  tv->tv_usec = t.millitm * 1000;
+  return t.time * 1000 + t.millitm;
 #elif defined (ECOS)
   // FIXME.
-  tv->tv_sec = _clock () / 1000;
-  tv->tv_usec = 0;
+  return _clock();
 #else
   // In the absence of any function, time remains forever fixed.
-  tv->tv_sec = 23;
-  tv->tv_usec = 0;
+  return 23000;
 #endif
 }
 
index f425462523db0e0df0964392dca36bf5647e7d96..a019cb7580685a5c54d58a4e72d00fe327fc0a8f 100644 (file)
@@ -10,6 +10,7 @@ details.  */
 
 #include <config.h>
 #include <jvm.h>
+#include <sys/timeb.h>
 
 #include "platform.h"
 #include <java/lang/ArithmeticException.h>
@@ -39,10 +40,11 @@ _Jv_platform_initialize (void)
 }
 
 // gettimeofday implementation.
-void
-_Jv_platform_gettimeofday (struct timeval *tv)
+jlong
+_Jv_platform_gettimeofday ()
 {
-  // FIXME
-  return;
+  struct timeb t;
+  ftime (&t);
+  return t.time * 1000 + t.millitm;
 }
 
This page took 0.101168 seconds and 5 git commands to generate.