|
1 | 1 | /* |
2 | | - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
112 | 112 | * <pre><code> |
113 | 113 | * // Base GMT offset: -8:00 |
114 | 114 | * // DST starts: at 2:00am in standard time |
115 | | - * // on the first Sunday in April |
| 115 | + * // on the second Sunday in March |
116 | 116 | * // DST ends: at 2:00am in daylight time |
117 | | - * // on the last Sunday in October |
| 117 | + * // on the first Sunday in November |
118 | 118 | * // Save: 1 hour |
119 | 119 | * SimpleTimeZone(-28800000, |
120 | 120 | * "America/Los_Angeles", |
121 | | - * Calendar.APRIL, 1, -Calendar.SUNDAY, |
| 121 | + * Calendar.MARCH, 8, -Calendar.SUNDAY, |
122 | 122 | * 7200000, |
123 | | - * Calendar.OCTOBER, -1, Calendar.SUNDAY, |
| 123 | + * Calendar.NOVEMBER, 1, -Calendar.SUNDAY, |
124 | 124 | * 7200000, |
125 | 125 | * 3600000) |
126 | 126 | * |
@@ -857,13 +857,24 @@ public Object clone() |
857 | 857 | } |
858 | 858 |
|
859 | 859 | /** |
860 | | - * Generates the hash code for the SimpleDateFormat object. |
| 860 | + * Generates the hash code for the SimpleTimeZone object. |
861 | 861 | * @return the hash code for this object |
862 | 862 | */ |
863 | 863 | public int hashCode() |
864 | 864 | { |
865 | | - return startMonth ^ startDay ^ startDayOfWeek ^ startTime ^ |
866 | | - endMonth ^ endDay ^ endDayOfWeek ^ endTime ^ rawOffset; |
| 865 | + int hash = 31 * getID().hashCode() + rawOffset; |
| 866 | + hash = 31 * hash + Boolean.hashCode(useDaylight); |
| 867 | + if (useDaylight) { |
| 868 | + hash = 31 * hash + startMonth; |
| 869 | + hash = 31 * hash + startDay; |
| 870 | + hash = 31 * hash + startDayOfWeek; |
| 871 | + hash = 31 * hash + startTime; |
| 872 | + hash = 31 * hash + endMonth; |
| 873 | + hash = 31 * hash + endDay; |
| 874 | + hash = 31 * hash + endDayOfWeek; |
| 875 | + hash = 31 * hash + endTime; |
| 876 | + } |
| 877 | + return hash; |
867 | 878 | } |
868 | 879 |
|
869 | 880 | /** |
|
0 commit comments