8157175: GetNanoTimeAdjustment.java fails with excessive adjustment error
authordholmes
Wed, 25 May 2016 16:23:15 -0400
changeset 38705 447351211aa7
parent 38703 d3906fec707e
child 38706 01e5e74d3e4e
8157175: GetNanoTimeAdjustment.java fails with excessive adjustment error Reviewed-by: dcubed, gziemski
hotspot/src/os/solaris/vm/os_solaris.cpp
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Tue May 24 12:42:43 2016 -0500
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed May 25 16:23:15 2016 -0400
@@ -1355,29 +1355,20 @@
   return (double)gethrvtime() / (double)hrtime_hz;
 }
 
-// in-memory timestamp support - has update accuracy of 1ms
-typedef void (*_get_nsec_fromepoch_func_t)(hrtime_t*);
-static _get_nsec_fromepoch_func_t _get_nsec_fromepoch = NULL;
-
 // Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis
 jlong os::javaTimeMillis() {
-  if (_get_nsec_fromepoch != NULL) {
-    hrtime_t now;
-    _get_nsec_fromepoch(&now);
-    return now / NANOSECS_PER_MILLISEC;
-  }
-  else {
-    timeval t;
-    if (gettimeofday(&t, NULL) == -1) {
-      fatal("os::javaTimeMillis: gettimeofday (%s)", os::strerror(errno));
-    }
-    return jlong(t.tv_sec) * 1000  +  jlong(t.tv_usec) / 1000;
-  }
-}
-
+  timeval t;
+  if (gettimeofday(&t, NULL) == -1) {
+    fatal("os::javaTimeMillis: gettimeofday (%s)", os::strerror(errno));
+  }
+  return jlong(t.tv_sec) * 1000  +  jlong(t.tv_usec) / 1000;
+}
+
+// Must return seconds+nanos since Jan 1 1970. This must use the same
+// time source as javaTimeMillis and can't use get_nsec_fromepoch as
+// we need better than 1ms accuracy
 void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
   timeval t;
-  // can't use get_nsec_fromepoch here as we need better accuracy than 1ms
   if (gettimeofday(&t, NULL) == -1) {
     fatal("os::javaTimeSystemUTC: gettimeofday (%s)", os::strerror(errno));
   }
@@ -4447,9 +4438,6 @@
   if (handle != NULL) {
     Solaris::_pthread_setname_np =  // from 11.3
         (Solaris::pthread_setname_np_func_t)dlsym(handle, "pthread_setname_np");
-
-    _get_nsec_fromepoch =           // from 11.3.6
-        (_get_nsec_fromepoch_func_t) dlsym(handle, "get_nsec_fromepoch");
   }
 }