<i18n dev> TimeZone API for getting raw offset and daylight saving amount

Masayoshi Okutsu Masayoshi.Okutsu at Sun.COM
Wed Aug 13 19:06:46 PDT 2008


I agree that the revised one is reasonable.

Thanks,
Masayoshi

On 8/14/2008 4:14 AM, Yoshito Umaoka wrote:
> Oops.. stupid mistake in the previous note..
>
> > public void getOffset(long date, int[] offsets) {
> >     if (offsets == null || offsets.length < 2) {
> >         offsets = new int[2];
> >     }
> >     if (inDaylightTime(new Date(date)) {
> >         offsets[1] = getDSTSavings();
> >         offsets[0] = getOffset(date) - offsets[1];
> >     } else {
> >         offsets[0] = getOffset(date);
> >         offsets[1] = 0;
> >     }
> > }
>
> int[] is not a return value of the method..
> Just let it throw NullPointerException or
> ArrayIndexOutOfBoundsException when int[] offsets is null
> or too short.
>
> public void getOffset(long date, int[] offsets) {
>     if (inDaylightTime(new Date(date)) {
>         offsets[1] = getDSTSavings();
>         offsets[0] = getOffset(date) - offsets[1];
>     } else {
>         offsets[0] = getOffset(date);
>         offsets[1] = 0;
>     }
> }
>
> Yoshito Umaoka (ICU Project)



More information about the i18n-dev mailing list