List of usage examples for android.os SystemClock elapsedRealtime
@CriticalNative native public static long elapsedRealtime();
From source file:Main.java
public static long ticksToNow(long l) { return SystemClock.elapsedRealtime() - l; }
From source file:Main.java
public static String getBootTimeString() { long ut = SystemClock.elapsedRealtime() / 1000; int h = (int) ((ut / 3600)); int m = (int) ((ut / 60) % 60); return h + ":" + m; }
From source file:Main.java
public static boolean isValidClick() { if (SystemClock.elapsedRealtime() - mLastClickTime < 1000) { return false; }//from w ww . j a v a 2 s. co m mLastClickTime = SystemClock.elapsedRealtime(); return true; }
From source file:Main.java
public static boolean isFastDoubleClick() { long time = SystemClock.elapsedRealtime(); long timeD = time - lastClickTime; if (0 < timeD && timeD < 500) { //0,5s return true; }//from w w w. j a va2 s . c om lastClickTime = time; return false; }
From source file:Main.java
public static boolean isFastDoubleClick() { long time = SystemClock.elapsedRealtime(); if (time - mLastClickTime <= SPACE_TIME) { return true; } else {// w ww . j av a2s. c om mLastClickTime = time; return false; } }
From source file:Main.java
public static long elapsedRealTimeNanos() { if (Build.VERSION.SDK_INT >= 17) { return SystemClock.elapsedRealtimeNanos(); }//ww w.j av a 2 s. co m return SystemClock.elapsedRealtime() * 1000000l; }
From source file:Main.java
@TargetApi(17) public static long elapsedRealTimeNanos() { if (Build.VERSION.SDK_INT >= 17) { return SystemClock.elapsedRealtimeNanos(); }// ww w .j a va 2s .co m return SystemClock.elapsedRealtime() * 1000000l; }
From source file:Main.java
public static boolean setAlarmByBC(Context context, Class<?> bc_class, int period) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (alarmManager == null) return false; long triggerAtTime = SystemClock.elapsedRealtime() + period; Intent i = new Intent(context, bc_class); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); alarmManager.set(AlarmManager.ELAPSED_REALTIME, triggerAtTime, pi); return true;/* w w w. ja v a 2 s .c o m*/ }
From source file:Main.java
public static long getTime(String dateString) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try {//from ww w . j a v a 2s.c o m Date date = formatter.parse(dateString); return date.getTime(); } catch (ParseException e) { e.printStackTrace(); } return SystemClock.elapsedRealtime(); }
From source file:Main.java
public static long stopRecord() { if (isRecording) { try {/*from w ww .j av a2 s . c o m*/ mRecorder.stop(); mRecorder.release(); } catch (Exception e) { } finally { mRecorder = null; isRecording = false; } return SystemClock.elapsedRealtime() - startTime; } else { return 0; } }