+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.
#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);
+
+
+
+
+
#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__ */
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
#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
}
#include <config.h>
#include <jvm.h>
+#include <sys/timeb.h>
#include "platform.h"
#include <java/lang/ArithmeticException.h>
}
// 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;
}