| 1 | // posix.cc -- Helper functions for POSIX-flavored OSs.
|
|---|
| 2 |
|
|---|
| 3 | /* Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
|---|
| 4 |
|
|---|
| 5 | This file is part of libgcj.
|
|---|
| 6 |
|
|---|
| 7 | This software is copyrighted work licensed under the terms of the
|
|---|
| 8 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|---|
| 9 | details. */
|
|---|
| 10 |
|
|---|
| 11 | #include <config.h>
|
|---|
| 12 |
|
|---|
| 13 | #include "posix.h"
|
|---|
| 14 |
|
|---|
| 15 | #include <stdlib.h>
|
|---|
| 16 | #include <errno.h>
|
|---|
| 17 | #include <signal.h>
|
|---|
| 18 |
|
|---|
| 19 | #include <jvm.h>
|
|---|
| 20 | #include <java/lang/Thread.h>
|
|---|
| 21 | #include <java/io/InterruptedIOException.h>
|
|---|
| 22 | #include <java/util/Properties.h>
|
|---|
| 23 |
|
|---|
| 24 | #if defined (ECOS)
|
|---|
| 25 | extern "C" unsigned long long _clock (void);
|
|---|
| 26 | #endif
|
|---|
| 27 |
|
|---|
| 28 | // gettimeofday implementation.
|
|---|
| 29 | jlong
|
|---|
| 30 | _Jv_platform_gettimeofday ()
|
|---|
| 31 | {
|
|---|
| 32 | #if defined (HAVE_GETTIMEOFDAY)
|
|---|
| 33 | timeval tv;
|
|---|
| 34 | gettimeofday (&tv, NULL);
|
|---|
| 35 | return (tv.tv_sec * 1000LL) + (tv.tv_usec / 1000LL);
|
|---|
| 36 | #elif defined (HAVE_TIME)
|
|---|
| 37 | return time (NULL) * 1000LL;
|
|---|
| 38 | #elif defined (HAVE_FTIME)
|
|---|
| 39 | struct timeb t;
|
|---|
| 40 | ftime (&t);
|
|---|
| 41 | return (t.time * 1000LL) + t.millitm;
|
|---|
| 42 | #elif defined (ECOS)
|
|---|
|
|---|