.withHourOfDay() behavior on DST daylight to standard transition?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

.withHourOfDay() behavior on DST daylight to standard transition?

HotMail-3
.withHourOfDay() behavior on DST daylight to standard transition?

Please let me know if what I found is a bug or not. Im using version 1.5.2. When the hour of day is set to the ambiguous hour on the daylight to standard time transition in a given time zone what should the result be? The daylight hour or the standard hour for all time zones? I cant find anything that documents this behavior.

My test code below returns different results for different time zones.


    /**

     * Verify Joda converts the hour of day the same for regions north and south of the equator on the DST

     * daylight to standard time transition.

     */

    @Test

    public void jodaTest ()

    {

        Chronology chronUTC = GregorianChronology.getInstance(DateTimeZone.UTC);

        DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0, 0, 0, chronUTC);

        DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0, 0, 0, chronUTC);

        Chronology chronUSCentral = GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));

        Assert.assertTrue("Should be standard time", chronUSCentral.getZone().isStandardOffset(

                usCentralStandardInUTC.getMillis()));

        Assert.assertFalse("Should be daylight time", chronUSCentral.getZone().isStandardOffset(

                usCentralDaylightInUTC.getMillis()));

        DateTime usCentralStandardInUSCentral = usCentralStandardInUTC.toDateTime(chronUSCentral);

        DateTime usCentralDaylightInUSCentral = usCentralDaylightInUTC.toDateTime(chronUSCentral);

        assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());

        assertEquals(usCentralStandardInUSCentral.getHourOfDay(),

                usCentralDaylightInUSCentral.getHourOfDay());

        Assert.assertTrue(usCentralStandardInUSCentral.getMillis() != usCentralDaylightInUSCentral.getMillis());

        DateTime australiaNSWStandardInUTC = new DateTime(2008, 4, 5, 16, 0, 0, 0, chronUTC);

        DateTime australiaNSWDaylightInUTC = new DateTime(2008, 4, 5, 15, 0, 0, 0, chronUTC);

        Chronology chronAusNSW = GregorianChronology.getInstance(DateTimeZone.forID("Australia/NSW"));

        Assert.assertTrue("Should be standard time", chronAusNSW.getZone().isStandardOffset(

                australiaNSWStandardInUTC.getMillis()));

        Assert.assertFalse("Should be daylight time", chronAusNSW.getZone().isStandardOffset(

                australiaNSWDaylightInUTC.getMillis()));

        DateTime australiaNSWStandardInAustraliaNSW = australiaNSWStandardInUTC.toDateTime(chronAusNSW);

        DateTime australiaNSWDaylightInAusraliaNSW = australiaNSWDaylightInUTC.toDateTime(chronAusNSW);

        assertEquals(2, australiaNSWStandardInAustraliaNSW.getHourOfDay());

        assertEquals(australiaNSWStandardInAustraliaNSW.getHourOfDay(),

                australiaNSWDaylightInAusraliaNSW.getHourOfDay());

        Assert.assertTrue(australiaNSWStandardInAustraliaNSW.getMillis() != australiaNSWDaylightInAusraliaNSW.getMillis());

        // Verify that setting the hour of day on the DST boundary results in a daylight time for

        // both time zones.

        assertEquals(usCentralDaylightInUSCentral, usCentralStandardInUSCentral.withHourOfDay(1));

        assertEquals(australiaNSWDaylightInAusraliaNSW,

                australiaNSWStandardInAustraliaNSW.withHourOfDay(2));

    }

The very last assertion fails on the Australia time zone cutover.

java.lang.AssertionError: expected:<2008-04-06T02:00:00.000+11:00> but was:<2008-04-06T02:00:00.000+10:00>

Bryan Madsen


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: .withHourOfDay() behavior on DST daylight to standard transition?

jodastephen
This situation should have been solved in the 1.5.x releases as per
the release notes. I haven't been able to run this code yet to verify
the behaviour.

Stephen


2008/9/24 Hotmail <[hidden email]>:

> Please let me know if what I found is a bug or not. I'm using version 1.5.2.
> When the hour of day is set to the ambiguous hour on the daylight to
> standard time transition in a given time zone what should the result be? The
> daylight hour or the standard hour for all time zones? I can't find anything
> that documents this behavior.
>
> My test code below returns different results for different time zones.
>
>     /**
>
>      * Verify Joda converts the hour of day the same for regions north and
> south of the equator on the DST
>
>      * daylight to standard time transition.
>
>      */
>
>     @Test
>
>     public void jodaTest ()
>
>     {
>
>         Chronology chronUTC =
> GregorianChronology.getInstance(DateTimeZone.UTC);
>
>         DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0, 0,
> 0, chronUTC);
>
>         DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0, 0,
> 0, chronUTC);
>
>         Chronology chronUSCentral =
> GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));
>
>         Assert.assertTrue("Should be standard time",
> chronUSCentral.getZone().isStandardOffset(
>
>                 usCentralStandardInUTC.getMillis()));
>
>         Assert.assertFalse("Should be daylight time",
> chronUSCentral.getZone().isStandardOffset(
>
>                 usCentralDaylightInUTC.getMillis()));
>
>         DateTime usCentralStandardInUSCentral =
> usCentralStandardInUTC.toDateTime(chronUSCentral);
>
>         DateTime usCentralDaylightInUSCentral =
> usCentralDaylightInUTC.toDateTime(chronUSCentral);
>
>         assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());
>
>         assertEquals(usCentralStandardInUSCentral.getHourOfDay(),
>
>                 usCentralDaylightInUSCentral.getHourOfDay());
>
>         Assert.assertTrue(usCentralStandardInUSCentral.getMillis() !=
> usCentralDaylightInUSCentral.getMillis());
>
>         DateTime australiaNSWStandardInUTC = new DateTime(2008, 4, 5, 16, 0,
> 0, 0, chronUTC);
>
>         DateTime australiaNSWDaylightInUTC = new DateTime(2008, 4, 5, 15, 0,
> 0, 0, chronUTC);
>
>         Chronology chronAusNSW =
> GregorianChronology.getInstance(DateTimeZone.forID("Australia/NSW"));
>
>         Assert.assertTrue("Should be standard time",
> chronAusNSW.getZone().isStandardOffset(
>
>                 australiaNSWStandardInUTC.getMillis()));
>
>         Assert.assertFalse("Should be daylight time",
> chronAusNSW.getZone().isStandardOffset(
>
>                 australiaNSWDaylightInUTC.getMillis()));
>
>         DateTime australiaNSWStandardInAustraliaNSW =
> australiaNSWStandardInUTC.toDateTime(chronAusNSW);
>
>         DateTime australiaNSWDaylightInAusraliaNSW =
> australiaNSWDaylightInUTC.toDateTime(chronAusNSW);
>
>         assertEquals(2, australiaNSWStandardInAustraliaNSW.getHourOfDay());
>
>         assertEquals(australiaNSWStandardInAustraliaNSW.getHourOfDay(),
>
>                 australiaNSWDaylightInAusraliaNSW.getHourOfDay());
>
>         Assert.assertTrue(australiaNSWStandardInAustraliaNSW.getMillis() !=
> australiaNSWDaylightInAusraliaNSW.getMillis());
>
>         // Verify that setting the hour of day on the DST boundary results
> in a daylight time for
>
>         // both time zones.
>
>         assertEquals(usCentralDaylightInUSCentral,
> usCentralStandardInUSCentral.withHourOfDay(1));
>
>         assertEquals(australiaNSWDaylightInAusraliaNSW,
>
>                 australiaNSWStandardInAustraliaNSW.withHourOfDay(2));
>
>     }
>
> The very last assertion fails on the Australia time zone cutover.
>
> java.lang.AssertionError: expected:<2008-04-06T02:00:00.000+11:00> but
> was:<2008-04-06T02:00:00.000+10:00>
>
> Bryan Madsen
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: .withHourOfDay() behavior on DST daylight to standard transition?

HotMail-3
Stephen, have you had a chance to look into this?

-----Original Message-----
From: Stephen Colebourne [mailto:[hidden email]]
Sent: Thursday, September 25, 2008 7:46 AM
To: Discussion of the Joda project
Subject: Re: [Joda-interest] .withHourOfDay() behavior on DST daylight to
standard transition?

This situation should have been solved in the 1.5.x releases as per
the release notes. I haven't been able to run this code yet to verify
the behaviour.

Stephen


2008/9/24 Hotmail <[hidden email]>:
> Please let me know if what I found is a bug or not. I'm using version
1.5.2.
> When the hour of day is set to the ambiguous hour on the daylight to
> standard time transition in a given time zone what should the result be?
The
> daylight hour or the standard hour for all time zones? I can't find
anything

> that documents this behavior.
>
> My test code below returns different results for different time zones.
>
>     /**
>
>      * Verify Joda converts the hour of day the same for regions north and
> south of the equator on the DST
>
>      * daylight to standard time transition.
>
>      */
>
>     @Test
>
>     public void jodaTest ()
>
>     {
>
>         Chronology chronUTC =
> GregorianChronology.getInstance(DateTimeZone.UTC);
>
>         DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0,
0,
> 0, chronUTC);
>
>         DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0,
0,

> 0, chronUTC);
>
>         Chronology chronUSCentral =
> GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));
>
>         Assert.assertTrue("Should be standard time",
> chronUSCentral.getZone().isStandardOffset(
>
>                 usCentralStandardInUTC.getMillis()));
>
>         Assert.assertFalse("Should be daylight time",
> chronUSCentral.getZone().isStandardOffset(
>
>                 usCentralDaylightInUTC.getMillis()));
>
>         DateTime usCentralStandardInUSCentral =
> usCentralStandardInUTC.toDateTime(chronUSCentral);
>
>         DateTime usCentralDaylightInUSCentral =
> usCentralDaylightInUTC.toDateTime(chronUSCentral);
>
>         assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());
>
>         assertEquals(usCentralStandardInUSCentral.getHourOfDay(),
>
>                 usCentralDaylightInUSCentral.getHourOfDay());
>
>         Assert.assertTrue(usCentralStandardInUSCentral.getMillis() !=
> usCentralDaylightInUSCentral.getMillis());
>
>         DateTime australiaNSWStandardInUTC = new DateTime(2008, 4, 5, 16,
0,
> 0, 0, chronUTC);
>
>         DateTime australiaNSWDaylightInUTC = new DateTime(2008, 4, 5, 15,
0,

> 0, 0, chronUTC);
>
>         Chronology chronAusNSW =
> GregorianChronology.getInstance(DateTimeZone.forID("Australia/NSW"));
>
>         Assert.assertTrue("Should be standard time",
> chronAusNSW.getZone().isStandardOffset(
>
>                 australiaNSWStandardInUTC.getMillis()));
>
>         Assert.assertFalse("Should be daylight time",
> chronAusNSW.getZone().isStandardOffset(
>
>                 australiaNSWDaylightInUTC.getMillis()));
>
>         DateTime australiaNSWStandardInAustraliaNSW =
> australiaNSWStandardInUTC.toDateTime(chronAusNSW);
>
>         DateTime australiaNSWDaylightInAusraliaNSW =
> australiaNSWDaylightInUTC.toDateTime(chronAusNSW);
>
>         assertEquals(2,
australiaNSWStandardInAustraliaNSW.getHourOfDay());
>
>         assertEquals(australiaNSWStandardInAustraliaNSW.getHourOfDay(),
>
>                 australiaNSWDaylightInAusraliaNSW.getHourOfDay());
>
>         Assert.assertTrue(australiaNSWStandardInAustraliaNSW.getMillis()
!=

> australiaNSWDaylightInAusraliaNSW.getMillis());
>
>         // Verify that setting the hour of day on the DST boundary results
> in a daylight time for
>
>         // both time zones.
>
>         assertEquals(usCentralDaylightInUSCentral,
> usCentralStandardInUSCentral.withHourOfDay(1));
>
>         assertEquals(australiaNSWDaylightInAusraliaNSW,
>
>                 australiaNSWStandardInAustraliaNSW.withHourOfDay(2));
>
>     }
>
> The very last assertion fails on the Australia time zone cutover.
>
> java.lang.AssertionError: expected:<2008-04-06T02:00:00.000+11:00> but
> was:<2008-04-06T02:00:00.000+10:00>
>
> Bryan Madsen
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: .withHourOfDay() behavior on DST daylight to standard transition?

jodastephen
The behaviour can be reproduced, however the code in this ares is very
fragile. Trying to fix similar issues in v1.5 caused a number of knock
on effects, and I would prefer to not attempt a fix on this occasion.

Stephen


Bryan Madsen wrote:

> Stephen, have you had a chance to look into this?
>
> -----Original Message-----
> From: Stephen Colebourne [mailto:[hidden email]]
> Sent: Thursday, September 25, 2008 7:46 AM
> To: Discussion of the Joda project
> Subject: Re: [Joda-interest] .withHourOfDay() behavior on DST daylight to
> standard transition?
>
> This situation should have been solved in the 1.5.x releases as per
> the release notes. I haven't been able to run this code yet to verify
> the behaviour.
>
> Stephen
>
>
> 2008/9/24 Hotmail <[hidden email]>:
>> Please let me know if what I found is a bug or not. I'm using version
> 1.5.2.
>> When the hour of day is set to the ambiguous hour on the daylight to
>> standard time transition in a given time zone what should the result be?
> The
>> daylight hour or the standard hour for all time zones? I can't find
> anything
>> that documents this behavior.
>>
>> My test code below returns different results for different time zones.
>>
>>     /**
>>
>>      * Verify Joda converts the hour of day the same for regions north and
>> south of the equator on the DST
>>
>>      * daylight to standard time transition.
>>
>>      */
>>
>>     @Test
>>
>>     public void jodaTest ()
>>
>>     {
>>
>>         Chronology chronUTC =
>> GregorianChronology.getInstance(DateTimeZone.UTC);
>>
>>         DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0,
> 0,
>> 0, chronUTC);
>>
>>         DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0,
> 0,
>> 0, chronUTC);
>>
>>         Chronology chronUSCentral =
>> GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));
>>
>>         Assert.assertTrue("Should be standard time",
>> chronUSCentral.getZone().isStandardOffset(
>>
>>                 usCentralStandardInUTC.getMillis()));
>>
>>         Assert.assertFalse("Should be daylight time",
>> chronUSCentral.getZone().isStandardOffset(
>>
>>                 usCentralDaylightInUTC.getMillis()));
>>
>>         DateTime usCentralStandardInUSCentral =
>> usCentralStandardInUTC.toDateTime(chronUSCentral);
>>
>>         DateTime usCentralDaylightInUSCentral =
>> usCentralDaylightInUTC.toDateTime(chronUSCentral);
>>
>>         assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());
>>
>>         assertEquals(usCentralStandardInUSCentral.getHourOfDay(),
>>
>>                 usCentralDaylightInUSCentral.getHourOfDay());
>>
>>         Assert.assertTrue(usCentralStandardInUSCentral.getMillis() !=
>> usCentralDaylightInUSCentral.getMillis());
>>
>>         DateTime australiaNSWStandardInUTC = new DateTime(2008, 4, 5, 16,
> 0,
>> 0, 0, chronUTC);
>>
>>         DateTime australiaNSWDaylightInUTC = new DateTime(2008, 4, 5, 15,
> 0,
>> 0, 0, chronUTC);
>>
>>         Chronology chronAusNSW =
>> GregorianChronology.getInstance(DateTimeZone.forID("Australia/NSW"));
>>
>>         Assert.assertTrue("Should be standard time",
>> chronAusNSW.getZone().isStandardOffset(
>>
>>                 australiaNSWStandardInUTC.getMillis()));
>>
>>         Assert.assertFalse("Should be daylight time",
>> chronAusNSW.getZone().isStandardOffset(
>>
>>                 australiaNSWDaylightInUTC.getMillis()));
>>
>>         DateTime australiaNSWStandardInAustraliaNSW =
>> australiaNSWStandardInUTC.toDateTime(chronAusNSW);
>>
>>         DateTime australiaNSWDaylightInAusraliaNSW =
>> australiaNSWDaylightInUTC.toDateTime(chronAusNSW);
>>
>>         assertEquals(2,
> australiaNSWStandardInAustraliaNSW.getHourOfDay());
>>         assertEquals(australiaNSWStandardInAustraliaNSW.getHourOfDay(),
>>
>>                 australiaNSWDaylightInAusraliaNSW.getHourOfDay());
>>
>>         Assert.assertTrue(australiaNSWStandardInAustraliaNSW.getMillis()
> !=
>> australiaNSWDaylightInAusraliaNSW.getMillis());
>>
>>         // Verify that setting the hour of day on the DST boundary results
>> in a daylight time for
>>
>>         // both time zones.
>>
>>         assertEquals(usCentralDaylightInUSCentral,
>> usCentralStandardInUSCentral.withHourOfDay(1));
>>
>>         assertEquals(australiaNSWDaylightInAusraliaNSW,
>>
>>                 australiaNSWStandardInAustraliaNSW.withHourOfDay(2));
>>
>>     }
>>
>> The very last assertion fails on the Australia time zone cutover.
>>
>> java.lang.AssertionError: expected:<2008-04-06T02:00:00.000+11:00> but
>> was:<2008-04-06T02:00:00.000+10:00>
>>
>> Bryan Madsen
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Joda-interest mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>>
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: .withHourOfDay() behavior on DST daylight to standard transition?

HotMail-3
I logged a new bug [1] for this. The question that still remains is what is
the expected behavior? At a minimum can that be documented? I now need to
account for this issue on any DST transition.


[1]
https://sourceforge.net/tracker/index.php?func=detail&aid=2182444&group_id=9
7367&atid=617889

Bryan

-----Original Message-----
From: Stephen Colebourne [mailto:[hidden email]]
Sent: Sunday, October 19, 2008 4:30 PM
To: Discussion of the Joda project
Subject: Re: [Joda-interest] .withHourOfDay() behavior on DST daylight to
standard transition?

The behaviour can be reproduced, however the code in this ares is very
fragile. Trying to fix similar issues in v1.5 caused a number of knock
on effects, and I would prefer to not attempt a fix on this occasion.

Stephen


Bryan Madsen wrote:

> Stephen, have you had a chance to look into this?
>
> -----Original Message-----
> From: Stephen Colebourne [mailto:[hidden email]]
> Sent: Thursday, September 25, 2008 7:46 AM
> To: Discussion of the Joda project
> Subject: Re: [Joda-interest] .withHourOfDay() behavior on DST daylight to
> standard transition?
>
> This situation should have been solved in the 1.5.x releases as per
> the release notes. I haven't been able to run this code yet to verify
> the behaviour.
>
> Stephen
>
>
> 2008/9/24 Hotmail <[hidden email]>:
>> Please let me know if what I found is a bug or not. I'm using version
> 1.5.2.
>> When the hour of day is set to the ambiguous hour on the daylight to
>> standard time transition in a given time zone what should the result be?
> The
>> daylight hour or the standard hour for all time zones? I can't find
> anything
>> that documents this behavior.
>>
>> My test code below returns different results for different time zones.
>>
>>     /**
>>
>>      * Verify Joda converts the hour of day the same for regions north
and

>> south of the equator on the DST
>>
>>      * daylight to standard time transition.
>>
>>      */
>>
>>     @Test
>>
>>     public void jodaTest ()
>>
>>     {
>>
>>         Chronology chronUTC =
>> GregorianChronology.getInstance(DateTimeZone.UTC);
>>
>>         DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0,
> 0,
>> 0, chronUTC);
>>
>>         DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0,
> 0,
>> 0, chronUTC);
>>
>>         Chronology chronUSCentral =
>> GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));
>>
>>         Assert.assertTrue("Should be standard time",
>> chronUSCentral.getZone().isStandardOffset(
>>
>>                 usCentralStandardInUTC.getMillis()));
>>
>>         Assert.assertFalse("Should be daylight time",
>> chronUSCentral.getZone().isStandardOffset(
>>
>>                 usCentralDaylightInUTC.getMillis()));
>>
>>         DateTime usCentralStandardInUSCentral =
>> usCentralStandardInUTC.toDateTime(chronUSCentral);
>>
>>         DateTime usCentralDaylightInUSCentral =
>> usCentralDaylightInUTC.toDateTime(chronUSCentral);
>>
>>         assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());
>>
>>         assertEquals(usCentralStandardInUSCentral.getHourOfDay(),
>>
>>                 usCentralDaylightInUSCentral.getHourOfDay());
>>
>>         Assert.assertTrue(usCentralStandardInUSCentral.getMillis() !=
>> usCentralDaylightInUSCentral.getMillis());
>>
>>         DateTime australiaNSWStandardInUTC = new DateTime(2008, 4, 5, 16,
> 0,
>> 0, 0, chronUTC);
>>
>>         DateTime australiaNSWDaylightInUTC = new DateTime(2008, 4, 5, 15,
> 0,
>> 0, 0, chronUTC);
>>
>>         Chronology chronAusNSW =
>> GregorianChronology.getInstance(DateTimeZone.forID("Australia/NSW"));
>>
>>         Assert.assertTrue("Should be standard time",
>> chronAusNSW.getZone().isStandardOffset(
>>
>>                 australiaNSWStandardInUTC.getMillis()));
>>
>>         Assert.assertFalse("Should be daylight time",
>> chronAusNSW.getZone().isStandardOffset(
>>
>>                 australiaNSWDaylightInUTC.getMillis()));
>>
>>         DateTime australiaNSWStandardInAustraliaNSW =
>> australiaNSWStandardInUTC.toDateTime(chronAusNSW);
>>
>>         DateTime australiaNSWDaylightInAusraliaNSW =
>> australiaNSWDaylightInUTC.toDateTime(chronAusNSW);
>>
>>         assertEquals(2,
> australiaNSWStandardInAustraliaNSW.getHourOfDay());
>>         assertEquals(australiaNSWStandardInAustraliaNSW.getHourOfDay(),
>>
>>                 australiaNSWDaylightInAusraliaNSW.getHourOfDay());
>>
>>         Assert.assertTrue(australiaNSWStandardInAustraliaNSW.getMillis()
> !=
>> australiaNSWDaylightInAusraliaNSW.getMillis());
>>
>>         // Verify that setting the hour of day on the DST boundary
results

>> in a daylight time for
>>
>>         // both time zones.
>>
>>         assertEquals(usCentralDaylightInUSCentral,
>> usCentralStandardInUSCentral.withHourOfDay(1));
>>
>>         assertEquals(australiaNSWDaylightInAusraliaNSW,
>>
>>                 australiaNSWStandardInAustraliaNSW.withHourOfDay(2));
>>
>>     }
>>
>> The very last assertion fails on the Australia time zone cutover.
>>
>> java.lang.AssertionError: expected:<2008-04-06T02:00:00.000+11:00> but
>> was:<2008-04-06T02:00:00.000+10:00>
>>
>> Bryan Madsen
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Joda-interest mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>>
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
> Build the coolest Linux based applications with Moblin SDK & win great
prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...