update uptimeMillis to get boot time
Change-Id: I0f0c8235898e33ed6cee69d7d4c5a1e9b199c835 CRs-Fixed: 2209099
This commit is contained in:
parent
7f9ce9ddd0
commit
6530ba80ad
1 changed files with 12 additions and 1 deletions
|
@ -31,7 +31,18 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
#include <utils/SystemClock.h>
|
||||
#define uptimeMillis android::uptimeMillis
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
inline int64_t uptimeMillis()
|
||||
{
|
||||
struct timespec ts;
|
||||
int64_t time_ms = 0;
|
||||
clock_gettime(CLOCK_BOOTTIME, &ts);
|
||||
time_ms += (ts.tv_sec * 1000000000LL);
|
||||
time_ms += ts.tv_nsec + 500000LL;
|
||||
return time_ms / 1000000LL;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue