From ca778258c803da3bc6a115d3094efad020930592 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Sat, 16 Aug 2014 18:40:13 +0100 Subject: [PATCH] HHH-9344 Convert QueryLoader to use nanoTime instead of currentTimeMillis --- .../main/java/org/hibernate/loader/hql/QueryLoader.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java index e3a4c73136..cd553624a9 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java @@ -32,6 +32,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import org.hibernate.HibernateException; import org.hibernate.LockMode; @@ -509,7 +510,7 @@ public class QueryLoader extends BasicLoader { final boolean stats = session.getFactory().getStatistics().isStatisticsEnabled(); long startTime = 0; if ( stats ) { - startTime = System.currentTimeMillis(); + startTime = System.nanoTime(); } try { @@ -530,11 +531,13 @@ public class QueryLoader extends BasicLoader { ); if ( stats ) { + final long endTime = System.nanoTime(); + final long milliseconds = TimeUnit.MILLISECONDS.convert( endTime - startTime, TimeUnit.NANOSECONDS ); session.getFactory().getStatisticsImplementor().queryExecuted( // "HQL: " + queryTranslator.getQueryString(), getQueryIdentifier(), 0, - System.currentTimeMillis() - startTime + milliseconds ); }