Files
MoGoEagleEye/libraries/map-usbcamera/src/main/java/com/serenegiant/utils/Time.java
donghongyu cdee266805 [Change]
开始USB摄像头的功能集成,还无法获取usb连接广播需要调试

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
(cherry picked from commit b10306fc45)
2022-02-15 14:26:43 +08:00

41 lines
722 B
Java

package com.serenegiant.utils;
import android.annotation.SuppressLint;
import android.os.SystemClock;
public class Time {
public static boolean prohibitElapsedRealtimeNanos = true;
private static Time sTime;
static {
reset();
}
public static long nanoTime() {
return sTime.timeNs();
}
public static void reset() {
if (!prohibitElapsedRealtimeNanos && BuildCheck.isJellyBeanMr1()) {
sTime = new TimeJellyBeanMr1();
} else {
sTime = new Time();
}
}
private Time() {
}
@SuppressLint("NewApi")
private static class TimeJellyBeanMr1 extends Time {
public long timeNs() {
return SystemClock.elapsedRealtimeNanos();
}
}
protected long timeNs() {
return System.nanoTime();
}
}