Skip to content Skip to sidebar Skip to footer

Which Is Android/java Corresponding Method To The C#/c++ Method Gettickcount()?

I wanna know a corresponding method in Android/Java that is like the GetTickCount method in C#/C++?

Solution 1:

For Android it is SystemClock.uptimeMillis(). Please note that uptimeMillis() does not include time spent in deep sleep. You may need SystemClock.elapsedRealtime() for total time after boot.

Solution 2:

The accepted answer gives the milliseconds since boot, but the answer for me is System.currentTimeMillis(). This gives you the number of milliseconds in UTC since January 1, 1970. This is the equivalent of what GetTickCount method does.

Post a Comment for "Which Is Android/java Corresponding Method To The C#/c++ Method Gettickcount()?"