`
folksy
  • 浏览: 156937 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

三种获取系统时间函数的差别

阅读更多

import android.os.SystemClock;

三种获取系统时间函数的差别
    SystemClock.currentThreadTimeMillis();
    SystemClock.elapsedRealtime();
    SystemClock.uptimeMillis();


    /**
     * Returns milliseconds since boot, not counting time spent in deep sleep.
     * <b>Note:</b> This value may get reset occasionally (before it would
     * otherwise wrap around).
     *
     * @return milliseconds of non-sleep uptime since boot.
     */
    native public static long uptimeMillis();

    /**
     * Returns milliseconds since boot, including time spent in sleep.
     *
     * @return elapsed milliseconds since boot.
     */
    native public static long elapsedRealtime();
   
    /**
     * Returns milliseconds running in the current thread.
     *
     * @return elapsed milliseconds in the thread
     */
    public static native long currentThreadTimeMillis();

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics