mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
6453901: (cal) clean up sun.util.calendar classes
Reviewed-by: naoto, lancea
This commit is contained in:
parent
acf899612f
commit
f1f4e1de44
10 changed files with 29 additions and 210 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -297,9 +297,9 @@ public final class ZoneInfoFile {
|
|||
* Loads the rules from a DateInputStream
|
||||
*
|
||||
* @param dis the DateInputStream to load, not null
|
||||
* @throws Exception if an error occurs
|
||||
* @throws IOException if an error occurs
|
||||
*/
|
||||
private static void load(DataInputStream dis) throws ClassNotFoundException, IOException {
|
||||
private static void load(DataInputStream dis) throws IOException {
|
||||
if (dis.readByte() != 1) {
|
||||
throw new StreamCorruptedException("File format not recognised");
|
||||
}
|
||||
|
@ -418,7 +418,8 @@ public final class ZoneInfoFile {
|
|||
//Current time. Used to determine future GMToffset transitions
|
||||
private static final long CURRT = System.currentTimeMillis()/1000;
|
||||
|
||||
/* Get a ZoneInfo instance.
|
||||
/**
|
||||
* Get a ZoneInfo instance.
|
||||
*
|
||||
* @param standardTransitions the standard transitions, not null
|
||||
* @param standardOffsets the standard offsets, not null
|
||||
|
@ -711,9 +712,7 @@ public final class ZoneInfoFile {
|
|||
for (i = 0; i < transitions.length; i++) {
|
||||
long val = transitions[i];
|
||||
int dst = (int)((val >>> DST_NSHIFT) & 0xfL);
|
||||
int saving = (dst == 0) ? 0 : offsets[dst];
|
||||
int index = (int)(val & OFFSET_MASK);
|
||||
int offset = offsets[index];
|
||||
long second = (val >> TRANSITION_NSHIFT);
|
||||
// javazic uses "index of the offset in offsets",
|
||||
// instead of the real offset value itself to
|
||||
|
@ -780,13 +779,11 @@ public final class ZoneInfoFile {
|
|||
int marchDoy0 = (int) doyEst;
|
||||
// convert march-based values back to january-based
|
||||
int marchMonth0 = (marchDoy0 * 5 + 2) / 153;
|
||||
int month = (marchMonth0 + 2) % 12 + 1;
|
||||
int dom = marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
|
||||
yearEst += marchMonth0 / 10;
|
||||
return (int)yearEst;
|
||||
}
|
||||
|
||||
private static final int toCalendarDOW[] = new int[] {
|
||||
private static final int[] toCalendarDOW = new int[] {
|
||||
-1,
|
||||
Calendar.MONDAY,
|
||||
Calendar.TUESDAY,
|
||||
|
@ -797,7 +794,7 @@ public final class ZoneInfoFile {
|
|||
Calendar.SUNDAY
|
||||
};
|
||||
|
||||
private static final int toSTZTime[] = new int[] {
|
||||
private static final int[] toSTZTime = new int[] {
|
||||
SimpleTimeZone.UTC_TIME,
|
||||
SimpleTimeZone.WALL_TIME,
|
||||
SimpleTimeZone.STANDARD_TIME,
|
||||
|
@ -821,8 +818,8 @@ public final class ZoneInfoFile {
|
|||
}
|
||||
|
||||
// return updated nOffsets
|
||||
private static int addTrans(long transitions[], int nTrans,
|
||||
int offsets[], int nOffsets,
|
||||
private static int addTrans(long[] transitions, int nTrans,
|
||||
int[] offsets, int nOffsets,
|
||||
long trans, int offset, int stdOffset) {
|
||||
int offsetIndex = indexOf(offsets, 0, nOffsets, offset);
|
||||
if (offsetIndex == nOffsets)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue