mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Use nanoTime for elapsed time
This commit is contained in:
parent
fc5774ff13
commit
096cae7fcb
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue