From fb03e913c0c55a9a96e93a00ef6590b9bea9a62a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 7 Mar 2023 01:33:22 +0100 Subject: Clock: Use Clock.currentNanos() instead of System.nanoTime(); Enhancing FPSCounterImpl accuracy by maintaining timestamps in [ns] Idea: Perhaps we want to use [ns] for FPSCounter's method types by now? --- src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 6b102ea68..1435aa20a 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -73,6 +73,7 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; import com.jogamp.common.GlueGenVersion; +import com.jogamp.common.os.Clock; import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionUtil; import com.jogamp.common.util.locks.RecursiveLock; @@ -679,7 +680,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public synchronized void setVisibleActionPost(final boolean visible, final boolean nativeWindowCreated) { long t0; if(Window.DEBUG_IMPLEMENTATION) { - t0 = System.nanoTime(); + t0 = Clock.currentNanos(); System.err.println("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+WindowImpl.getThreadName()+", start"); } else { t0 = 0; @@ -710,7 +711,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } } if(Window.DEBUG_IMPLEMENTATION) { - System.err.println("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+WindowImpl.getThreadName()+", fin: dt "+ (System.nanoTime()-t0)/1e6 +"ms"); + System.err.println("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+WindowImpl.getThreadName()+", fin: dt "+ (Clock.currentNanos()-t0)/1e6 +"ms"); } } -- cgit v1.2.3