diff options
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/Calendar.java | 6 | ||||
-rw-r--r-- | libjava/java/util/GregorianCalendar.java | 7 | ||||
-rw-r--r-- | libjava/java/util/TimeZone.java | 5 | ||||
-rw-r--r-- | libjava/java/util/natGregorianCalendar.cc | 11 |
4 files changed, 14 insertions, 15 deletions
diff --git a/libjava/java/util/Calendar.java b/libjava/java/util/Calendar.java index f31577a..05c3f63 100644 --- a/libjava/java/util/Calendar.java +++ b/libjava/java/util/Calendar.java @@ -257,7 +257,7 @@ public abstract class Calendar implements Serializable, Cloneable */ public static final int DECEMBER = 11; /** - * Constant representing Undecimber. This is an artifical name useful + * Constant representing Undecimber. This is an artificial name useful * for lunar calendars. */ public static final int UNDECIMBER = 12; @@ -581,9 +581,9 @@ public abstract class Calendar implements Serializable, Cloneable public final void set(int year, int month, int date, int hour, int minute) { set(year, month, date); - fields[HOUR] = hour; + fields[HOUR_OF_DAY] = hour; fields[MINUTE] = minute; - isSet[HOUR] = isSet[MINUTE] = true; + isSet[HOUR_OF_DAY] = isSet[MINUTE] = true; } /** diff --git a/libjava/java/util/GregorianCalendar.java b/libjava/java/util/GregorianCalendar.java index 3f6232a..cc06c29 100644 --- a/libjava/java/util/GregorianCalendar.java +++ b/libjava/java/util/GregorianCalendar.java @@ -115,23 +115,20 @@ public class GregorianCalendar extends Calendar { public GregorianCalendar (int year, int month, int date) { this(); - setDefaultTime (); - set (year, month, date); + set (year, month, date, 0, 0, 0); } public GregorianCalendar (int year, int month, int date, int hour, int minute) { this(); - setDefaultTime (); - set (year, month, date, hour, minute); + set (year, month, date, hour, minute, 0); } public GregorianCalendar (int year, int month, int date, int hour, int minute, int second) { this(); - setDefaultTime (); set (year, month, date, hour, minute, second); } diff --git a/libjava/java/util/TimeZone.java b/libjava/java/util/TimeZone.java index 5132973..0b9ea06 100644 --- a/libjava/java/util/TimeZone.java +++ b/libjava/java/util/TimeZone.java @@ -896,8 +896,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable int hours = offset / 60; int minutes = offset % 60; - sb.append('0' + hours / 10).append('0' + hours % 10).append(':'); - sb.append('0' + minutes / 10).append('0' + minutes % 10); + sb.append((char) ('0' + hours / 10)).append((char) ('0' + hours % 10)); + sb.append(':'); + sb.append((char) ('0' + minutes / 10)).append((char) ('0' + minutes % 10)); return sb.toString(); } diff --git a/libjava/java/util/natGregorianCalendar.cc b/libjava/java/util/natGregorianCalendar.cc index b1d66d2..58ee463 100644 --- a/libjava/java/util/natGregorianCalendar.cc +++ b/libjava/java/util/natGregorianCalendar.cc @@ -39,16 +39,17 @@ java::util::GregorianCalendar::computeTime () // Adjust for local timezone (introduced by mktime) and our // timezone. #if defined (STRUCT_TM_HAS_GMTOFF) - t += tim.tm_gmtoff; + t -= tim.tm_gmtoff; #elif defined (HAVE_TIMEZONE) - t -= timezone; + t += timezone; #endif - java::util::TimeZone *zone = getTimeZone (); - t += zone->getRawOffset(); - // Adjust for milliseconds. time = t * (jlong) 1000 + elements(fields)[MILLISECOND]; + // Now adjust for the real timezone, i.e. our timezone, which is in millis. + java::util::TimeZone *zone = getTimeZone (); + time += zone->getRawOffset(); + isTimeSet = true; } |