diff --git a/android/src/com/google/zxing/client/android/DecodeHandler.java b/android/src/com/google/zxing/client/android/DecodeHandler.java index b516c84a1..27c49f9ab 100644 --- a/android/src/com/google/zxing/client/android/DecodeHandler.java +++ b/android/src/com/google/zxing/client/android/DecodeHandler.java @@ -33,6 +33,7 @@ import android.util.Log; import java.io.ByteArrayOutputStream; import java.util.Map; +import java.util.concurrent.TimeUnit; final class DecodeHandler extends Handler { @@ -73,7 +74,7 @@ final class DecodeHandler extends Handler { * @param height The height of the preview frame. */ private void decode(byte[] data, int width, int height) { - long start = System.currentTimeMillis(); + long start = System.nanoTime(); Result rawResult = null; PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(data, width, height); if (source != null) { @@ -90,8 +91,8 @@ final class DecodeHandler extends Handler { Handler handler = activity.getHandler(); if (rawResult != null) { // Don't log the barcode contents for security. - long end = System.currentTimeMillis(); - Log.d(TAG, "Found barcode in " + (end - start) + " ms"); + long end = System.nanoTime(); + Log.d(TAG, "Found barcode in " + TimeUnit.NANOSECONDS.toMillis(end - start) + " ms"); if (handler != null) { Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();