diff options
| author | 2016-07-13 00:40:06 +0000 | |
|---|---|---|
| committer | 2016-07-13 00:40:07 +0000 | |
| commit | 4786f6d958908dc668d677e0260bbe821dd61298 (patch) | |
| tree | 22793dfae0e91a0550eb85b15a89de897b685d58 /cmds/bootanimation/BootAnimation.cpp | |
| parent | 6441738f4541850e7b55de1a6e42e2e8bd585ddd (diff) | |
| parent | 9676281c4f0b34707e34cf9d2f5a866f1979c405 (diff) | |
Merge "Don't show times before 2000-01-01" into nyc-mr1-dev
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
| -rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index d82629d3a4b4..4098772bba12 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -72,6 +72,8 @@ static const char LAST_TIME_CHANGED_FILE_NAME[] = "last_time_change"; static const char LAST_TIME_CHANGED_FILE_PATH[] = "/data/system/time/last_time_change"; static const char ACCURATE_TIME_FLAG_FILE_NAME[] = "time_is_accurate"; static const char ACCURATE_TIME_FLAG_FILE_PATH[] = "/data/system/time/time_is_accurate"; +// Java timestamp format. Don't show the clock if the date is before 2000-01-01 00:00:00. +static const long long ACCURATE_TIME_EPOCH = 946684800000; static const char EXIT_PROP_NAME[] = "service.bootanim.exit"; static const int ANIM_ENTRY_NAME_MAX = 256; @@ -932,8 +934,9 @@ bool BootAnimation::updateIsTimeAccurate() { clock_gettime(CLOCK_REALTIME, &now); // Match the Java timestamp format long long rtcNow = (now.tv_sec * 1000LL) + (now.tv_nsec / 1000000LL); - if (lastChangedTime > rtcNow - MAX_TIME_IN_PAST - && lastChangedTime < rtcNow + MAX_TIME_IN_FUTURE) { + if (ACCURATE_TIME_EPOCH < rtcNow + && lastChangedTime > (rtcNow - MAX_TIME_IN_PAST) + && lastChangedTime < (rtcNow + MAX_TIME_IN_FUTURE)) { mTimeIsAccurate = true; } } |