How often will uptimeMillis () reset, and this will affect Handler.postAtTime

The uptimeMillis method description says:

Returns the milliseconds since loading, not counting the time spent in deep sleep. Note: This value may get reset sometimes (otherwise wrap it before).

How often this can happen, and (more importantly) will affect Runnables, which must be carried out Handler.postAtTime ?

+3
source share
3 answers

Inclusion of timetimeMillis in SystemTime (), which on a Linux system goes into clock_gettime (CLOCK_MONOTONIC, struct timespec *).

struct time_t, 32- . , , .

, clock_gettime (CLOCK_MONOTONIC) Linux.

+2

uptimeMillis , , , postAtTime.

long Java :

-9,223,372,036,854,775,807 to 9,223,372,036,854,775,807 (~9.2E18)

9,2E18 - 292 277 266 . , , , , , , , .

, Android uptimeMillis

.,.

, , uptimeMillis reset - - !

+2

I used it for a service and never saw it reset. I would suggest that this does not happen. The problem with this postAtTime()is that it will not be called during sleep (since uptimeMillis()it will not be updated). If this is a problem, I would use a different method.

0
source

Source: https://habr.com/ru/post/1783442/


All Articles