diff options
author | Adam Megacz <adam@xwt.org> | 2002-03-08 01:03:56 +0000 |
---|---|---|
committer | Adam Megacz <megacz@gcc.gnu.org> | 2002-03-08 01:03:56 +0000 |
commit | 8eeda6e0e760b631414f9272beedfb6c007c5ad4 (patch) | |
tree | 5a6ecf62aa2257aff8b6a4fbbe492852b116c5d2 | |
parent | 3df3221216dd59d5d81a9791b9f90f3a43d4744d (diff) | |
download | gcc-8eeda6e0e760b631414f9272beedfb6c007c5ad4.zip gcc-8eeda6e0e760b631414f9272beedfb6c007c5ad4.tar.gz gcc-8eeda6e0e760b631414f9272beedfb6c007c5ad4.tar.bz2 |
win32.cc (_Jv_platform_gettimeofday): Now takes no args, returns jlong.
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
-rw-r--r-- | libjava/ChangeLog | 13 | ||||
-rw-r--r-- | libjava/include/posix.h | 9 | ||||
-rw-r--r-- | libjava/include/win32.h | 3 | ||||
-rw-r--r-- | libjava/java/lang/natSystem.cc | 4 | ||||
-rw-r--r-- | libjava/posix.cc | 20 | ||||
-rw-r--r-- | libjava/win32.cc | 10 |
6 files changed, 39 insertions, 20 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ef0022e..7c12541 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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. diff --git a/libjava/include/posix.h b/libjava/include/posix.h index bbfb0b2..f965074 100644 --- a/libjava/include/posix.h +++ b/libjava/include/posix.h @@ -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); + + + + + diff --git a/libjava/include/win32.h b/libjava/include/win32.h index 15b9ffc..c2ecbff 100644 --- a/libjava/include/win32.h +++ b/libjava/include/win32.h @@ -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__ */ diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc index c87168d..e8c0572 100644 --- a/libjava/java/lang/natSystem.cc +++ b/libjava/java/lang/natSystem.cc @@ -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 diff --git a/libjava/posix.cc b/libjava/posix.cc index 66443d2..56241d2 100644 --- a/libjava/posix.cc +++ b/libjava/posix.cc @@ -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 } diff --git a/libjava/win32.cc b/libjava/win32.cc index f425462..a019cb7 100644 --- a/libjava/win32.cc +++ b/libjava/win32.cc @@ -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; } |