public class TimeManager implements TrustedTime { private static final String TAG = TimeManager.class.getSimpleName(); private static TimeManager INSTANCE; private Class clsNtpTrustedTime; private Object mNtpTrustedTime; private static Object sync = new Object(); private boolean isNtpTimeUseAble = false; public boolean isNtpTimeUseAble() { return isNtpTimeUseAble; } private TimeManager() { } public static TimeManager getInstance(Context context) { if (INSTANCE == null) { synchronized (sync) { if (INSTANCE == null) { INSTANCE = new TimeManager(); try { INSTANCE.clsNtpTrustedTime = Class.forName("android.util.NtpTrustedTime"); Method getInstanceMethod = INSTANCE.clsNtpTrustedTime.getDeclaredMethod("getInstance", Context.class);
获取 ntp服务器时间
最新推荐文章于 2024-05-16 08:00:46 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)