aboutsummaryrefslogtreecommitdiff
path: root/libjava/posix.cc
diff options
context:
space:
mode:
authorAdam Megacz <adam@xwt.org>2002-03-08 01:03:56 +0000
committerAdam Megacz <megacz@gcc.gnu.org>2002-03-08 01:03:56 +0000
commit8eeda6e0e760b631414f9272beedfb6c007c5ad4 (patch)
tree5a6ecf62aa2257aff8b6a4fbbe492852b116c5d2 /libjava/posix.cc
parent3df3221216dd59d5d81a9791b9f90f3a43d4744d (diff)
downloadgcc-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
Diffstat (limited to 'libjava/posix.cc')
-rw-r--r--libjava/posix.cc20
1 files changed, 9 insertions, 11 deletions
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
}