aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util/natGregorianCalendar.cc
diff options
context:
space:
mode:
authorWarren Levy <warrenl@redhat.com>2000-12-28 05:55:56 +0000
committerWarren Levy <warrenl@gcc.gnu.org>2000-12-28 05:55:56 +0000
commited55bdc47f78302e9f7271300cef11be655bccc0 (patch)
tree4527372c96022ef87de67514404688cc3687737d /libjava/java/util/natGregorianCalendar.cc
parent5da1e2c4897295fb32739724224a86c866dff1d5 (diff)
downloadgcc-ed55bdc47f78302e9f7271300cef11be655bccc0.zip
gcc-ed55bdc47f78302e9f7271300cef11be655bccc0.tar.gz
gcc-ed55bdc47f78302e9f7271300cef11be655bccc0.tar.bz2
re PR libgcj/1358 (java.util.Date.toString() doesn't seem to behave properly.)
Fix for PR libgcj/1358: * java/lang/System.java: Update Copyright date properly. * java/util/Calendar.java: Fix typo in comment. (set): Set 24-hour clock hour instead of 12-hour clock hour. * java/util/GregorianCalendar.java (GregorianCalendar): Properly initialize times. Spec says to set H:M:S values to zero only if a date is given. * java/util/TimeZone.java (getDefaultDisplayName): Casts to char needed for evaluating numbers '0' to '9' in printouts of GMT offsets. * java/util/natGregorianCalendar.cc (computeTime): Properly handle timezones and GMT offsets, being careful to account for units of milliseconds vs. seconds. From-SVN: r38508
Diffstat (limited to 'libjava/java/util/natGregorianCalendar.cc')
-rw-r--r--libjava/java/util/natGregorianCalendar.cc11
1 files changed, 6 insertions, 5 deletions
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;
}