diff --git a/classpath/java-lang.cpp b/classpath/java-lang.cpp index 967deaadb4..5fd06cc8fe 100644 --- a/classpath/java-lang.cpp +++ b/classpath/java-lang.cpp @@ -27,6 +27,8 @@ # include "winbase.h" # include "io.h" # include "tchar.h" +# include "sys/types.h" +# include "sys/timeb.h" # define SO_PREFIX "" #else # define SO_PREFIX "lib" @@ -388,24 +390,9 @@ extern "C" JNIEXPORT jlong JNICALL Java_java_lang_System_currentTimeMillis(JNIEnv*, jclass) { #ifdef WIN32 - static LARGE_INTEGER frequency; - static LARGE_INTEGER time; - static bool init = true; - - if (init) { - QueryPerformanceFrequency(&frequency); - - if (frequency.QuadPart == 0) { - return 0; - } - - init = false; - } - - QueryPerformanceCounter(&time); - return static_cast - (((static_cast(time.QuadPart)) * 1000.0) / - (static_cast(frequency.QuadPart))); + _timeb tb; + _ftime(&tb); + return (static_cast(tb.time) * 1000) + static_cast(tb.millitm); #else timeval tv = { 0, 0 }; gettimeofday(&tv, 0);