android-uptimeMillis()重置的频率,它将影响Handler.postAtTime
作者:互联网
方法uptimeMillis的说明说:
Returns milliseconds since boot, not
counting time spent in deep sleep.
Note: This value may get reset
occasionally (before it would
otherwise wrap around).
这种情况多久发生一次,(更重要的是)它将影响应由Handler.postAtTime执行的可运行对象?
解决方法:
uptimeMillis调用在systemTime()中终止,在Linux系统上该调用变为clock_gettime(CLOCK_MONOTONIC,struct timespec *).
struct timespec在time_t中保留秒,这似乎是一个32位值.如果它开始计数接近于零,那么当它绕回时,您将不太可能存活.
如果您需要更多具体细节,则应研究Linux内核中clock_gettime(CLOCK_MONOTONIC)的行为.
标签:handler,timer,uptime,android 来源: https://codeday.me/bug/20191105/1995951.html