Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4300378

API: SimpleTimeZone: getDSTSavings() is returning improper value.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • core-libs
    • beta
    • generic, sparc
    • generic, solaris_7
    • Verified

      Even though a time zone does not observe DST, "getDSTSavings()" is returning a non-zero value.

      After discussing further with other I18N SQE, it was felt that this can be confusing to a user. Though the user does have "useDaylightTime()" to figure out whether the time zone observes DST, having "getDSTSavings()" return a contradicting value is inconsistent.

      Here's a quick program to demonstrate this:

      ----------------------------- Cut Here --------------------------

      import java.util.*;

      public class GetDSTSavingsTest {

          SimpleTimeZone stz;

          public GetDSTSavingsTest() {
              stz = (SimpleTimeZone)TimeZone.getTimeZone("Asia/Tokyo");

              System.out.println("Observes daylight savings time? " +
                                 stz.useDaylightTime());
              System.out.println("Daylight savings time value(should be 0 if not " +
                                 "observed): " + stz.getDSTSavings());
          }

          public static void main(String[] args) {
              new GetDSTSavingsTest();
          }
      }

      ----------------------------- Cut Here --------------------------

      edmund.lou@eng 1999-12-17

            okutsu Masayoshi Okutsu
            elousunw Edmund Lou (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: