AlarmManagerService: Fix daylight savings time offset computation
Fixes b/2244560 (Time Stamp On Bug Reports And Pictures Is One Hour Off) Change-Id: I69324a33f80e41ce68a0e6fdba08b80ed9453e19 Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
@@ -44,6 +44,7 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -260,8 +261,11 @@ class AlarmManagerService extends IAlarmManager.Stub {
|
||||
|
||||
// Update the kernel timezone information
|
||||
// Kernel tracks time offsets as 'minutes west of GMT'
|
||||
int gmtOffset = (zone.getRawOffset() + zone.getDSTSavings()) / 60000;
|
||||
setKernelTimezone(mDescriptor, -(gmtOffset));
|
||||
int gmtOffset = zone.getRawOffset();
|
||||
if (zone.inDaylightTime(new Date(System.currentTimeMillis()))) {
|
||||
gmtOffset += zone.getDSTSavings();
|
||||
}
|
||||
setKernelTimezone(mDescriptor, -(gmtOffset / 60000));
|
||||
}
|
||||
|
||||
TimeZone.setDefault(null);
|
||||
|
||||
Reference in New Issue
Block a user