]> gcc.gnu.org Git - gcc.git/commitdiff
TimeZone.java (getDateParams): Negate dayOfWeek.
authorJakub Jelinek <jakub@redhat.com>
Wed, 14 Feb 2007 19:31:58 +0000 (20:31 +0100)
committerAndrew Haley <aph@gcc.gnu.org>
Wed, 14 Feb 2007 19:31:58 +0000 (19:31 +0000)
2007-02-14  Jakub Jelinek  <jakub@redhat.com>
Andrew Haley  <aph@redhat.com>

* java/util/TimeZone.java (getDateParams): Negate dayOfWeek.

Co-Authored-By: Andrew Haley <aph@redhat.com>
From-SVN: r121955

libjava/classpath/ChangeLog
libjava/classpath/java/util/TimeZone.java

index 6dd05b94c1d880b0677e2207ff4c924c9b0f975d..85fa74c0b8c0f00dec6980722eabb0d4c194f325 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-14  Jakub Jelinek  <jakub@redhat.com>
+       Andrew Haley  <aph@redhat.com>
+
+       * java/util/TimeZone.java (getDateParams): Negate dayOfWeek.
+
 2007-02-09  Tom Tromey  <tromey@redhat.com>
 
        PR libgcj/30647:
index f349b031e95959f11c41467c39811b8d688c8686..a253561b0467424110e6f3bb1126927a89f7350d 100644 (file)
@@ -1090,18 +1090,30 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        int day;
 
        // Month, week of month, day of week
+
+       // "Mm.w.d".  d is between 0 (Sunday) and 6.  Week w is
+       // between 1 and 5; Week 1 is the first week in which day d
+       // occurs and Week 5 specifies the last d day in the month.
+       // Month m is between 1 and 12.
+
        month = Integer.parseInt(date.substring(1, date.indexOf('.')));
        int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
                                                   date.lastIndexOf('.')));
        int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
                                                        + 1));
-       if (week == 5)
-         day = -1; // last day of month is -1 in java, 5 in TZ
-       else
-         // first day of week starting on or after.
-         day = (week - 1) * 7 + 1;
-
        dayOfWeek++; // Java day of week is one-based, Sunday is first day.
+
+       if (week == 5)
+         day = -1; // last day of month is -1 in java, 5 in TZ
+       else
+         {
+           // First day of week starting on or after.  For example,
+           // to specify the second Sunday of April, set month to
+           // APRIL, day-of-month to 8, and day-of-week to -SUNDAY.
+           day = (week - 1) * 7 + 1;
+           dayOfWeek = -dayOfWeek;
+         }
+
        month--; // Java month is zero-based.
        return new int[] { month, day, dayOfWeek };
       }
This page took 0.090753 seconds and 5 git commands to generate.