diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-08 16:31:28 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-08 16:31:28 +0000 |
commit | 5695c2c7bb99356aaa744e4a2eded5f4d4d5fa57 (patch) | |
tree | 2bfe80e53394fccad5abf00a040a6681c74858e5 /libjava/posix.cc | |
parent | 10f0cf8aca09cec74156747a959bee8495897f68 (diff) | |
download | gcc-5695c2c7bb99356aaa744e4a2eded5f4d4d5fa57.tar.gz |
* posix.cc (internal_gettimeofday): New function.
(_Jv_select): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50442 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/posix.cc')
-rw-r--r-- | libjava/posix.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libjava/posix.cc b/libjava/posix.cc index 56241d241d1..f4b76962e35 100644 --- a/libjava/posix.cc +++ b/libjava/posix.cc @@ -62,6 +62,18 @@ _Jv_platform_initialize (void) #endif } +static inline void +internal_gettimeofday (struct timeval *result) +{ +#if defined (HAVE_GETTIMEOFDAY) + gettimeofday (result, NULL); +#else + jlong val = _Jv_platform_gettimeofday (); + result->tv_sec = val / 1000; + result->tv_usec = (val % 1000) * 1000; +#endif /* HAVE_GETTIMEOFDAY */ +} + // A wrapper for select() which ignores EINTR. int _Jv_select (int n, fd_set *readfds, fd_set *writefds, @@ -72,7 +84,7 @@ _Jv_select (int n, fd_set *readfds, fd_set *writefds, struct timeval end, delay; if (timeout) { - _Jv_platform_gettimeofday (&end); + internal_gettimeofday (&end); end.tv_usec += timeout->tv_usec; if (end.tv_usec >= 1000000) { @@ -102,7 +114,7 @@ _Jv_select (int n, fd_set *readfds, fd_set *writefds, struct timeval after; if (timeout) { - _Jv_platform_gettimeofday (&after); + internal_gettimeofday (&after); // Now compute new timeout argument. delay.tv_usec = end.tv_usec - after.tv_usec; delay.tv_sec = end.tv_sec - after.tv_sec; |