diff options
author | Neil Fuller <nfuller@google.com> | 2019-03-19 14:36:39 +0000 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2019-03-26 11:31:19 +0000 |
commit | f99d8a58054abee68e5da27d354d568652b5bc9d (patch) | |
tree | 306f1840ee9da84745febd74c757b90696539d5f /annotations/generate_annotated_java_files.py | |
parent | 24d3cb9b22542123f3b63c652d182153f86f158d (diff) |
Change behavior for times < first transition
In zic versions > 2014b there is a new transition for most zones
at Integer.MIN_VALUE seconds with the offset thought to be used at
that time (with varying degrees of certainty depending on zone).
This demonstrated a bug in Android's ZoneInfo class with how offsets
were picked for times before the first transition. The current docs
for tzfile state that the code should use the first non-DST type in
the file, but Android was using the offset associated with the first
non-DST transition.
This change should *mostly* stabilize the behavior with zic version
2014b and later by using the first non-DST type as suggested by the
tzfile docs.
For zones without good historical timekeeping data available, with
this change the offset for times before Integer.MIN_VALUE, and
between Integer.MIN_VALUE and the first "real" transition will be the
same so behavior will be consistent with and without a new zic
version.
For zones where there's good historical timekeeping data available,
such as America/New_York & Europe/London, there's information available
before Integer.MIN_VALUE (Dec 13, 1901 8:45:52 PM UTC). In these cases
the offset used at Integer.MIN_VALUE is not the same as the earliest
known offset. e.g. if there's one offset used before (say) 1883 (X),
another offset used after 1883 (Y) and a third offset used in 1915 (Z)
we will see X and Z with zic <= 2014b, but see X, Y & Z with
zic > 2014b. With zic > 2014b, Y is "visible" between
Integer.MIN_VALUE and 1915, while with zic <= 2014b we see X.
This change also modifies the WallTime.localtime() behavior:
In most places we use mEarliestRawOffset for the offset
before the first known transition but this was not the case with
localtime(), probably because android.text.format.Time is unreliable
around Integer.MIN_VALUE seconds due to historical int32 arithmetic
that has been ported to Java.
This change generally improves the documentation in ZoneInfo around
fields and improves variable names. The field names unfortunately
cannot be changed to include a units suffix (e.g. Millis) because of
serialized form.
Testing:
Ran CtsLibcoreTestCases with old zic data via CTS
Reran affected tests with both old and new zic data:
atest CtsTextTestCases:android.text.format.cts.TimeTest
atest CtsLibcoreTestCases:libcore.libcore.util.ZoneInfoTest
atest CtsLibcoreTestCases:libcore.java.util.TimeZoneTest
atest FrameworksCoreTests:android.text.format.TimeTest
After this change the following tests still fail with the new zic:
android.text.format.cts.TimeTest.test_bug118835133
Test: See above
Bug: 118835133
Change-Id: I9205fce583f0fc8abff3f9d45b8d2bf2f681d405
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions