• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTimestamp bug in timestampByAddingGregorianUnits
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimestamp bug in timestampByAddingGregorianUnits


  • Subject: Re: NSTimestamp bug in timestampByAddingGregorianUnits
  • From: email@hidden
  • Date: Wed, 7 Oct 2009 14:35:02 -0600 (MDT)
  • Importance: Normal


> Right, but according to the docs at
>
> http://developer.apple.com/legacy/mac/library/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/foundation/NSTimestamp.html#timestampByAddingGregorianUnits(int, int, int, int, int, int)
>
> "This method preserves "clock time" across changes in Daylight Savings
> Time zones and leap years. For example, adding one month to an
> NSTimestamp with a time of 12 noon correctly maintains time at 12 noon."
>
> So the time of 12:00:00 AM should have been preserved by
> timestampByAddingGregorianUnits

Yes. You are absolutely correct. I believe it is a bug. I assumed that
timestampByAddingGregorianUnits would not preserve "clock time" but that
certainly isn't what the API says.

>
> Ramsey
>
> On Oct 7, 2009, at 4:21 PM, David Avendasora wrote:
>
>> Isn't this the daylight-savings-time switch over? Currently we are 4
>> hours behind GMT, once DST is off, then we will be 5 hours behind GMT.
>>
>> Dave
>>
>> On Oct 7, 2009, at 4:13 PM, Ramsey Gurley wrote:
>>
>>> Hi all,
>>>
>>> Executing the following code with a default time zone of US Eastern
>>> time
>>>
>>> NSTimestamp ts1 = new
>>> NSTimestamp(2009,11,1,0,0,0,NSTimeZone.defaultTimeZone());
>>> NSTimestamp ts2 = ts1.timestampByAddingGregorianUnits( 0, 0, 1, 0,
>>> 0, 0 );
>>> NSTimestamp ts3 = new
>>> NSTimestamp(2009,11,2,0,0,0,NSTimeZone.defaultTimeZone());
>>> System.out.println(NSTimeZone.defaultTimeZone().getID());
>>> System.out.println(ts1 + "\n" + ts2 + "\n" + ts3);
>>>
>>> produces the following result :-/
>>>
>>> America/New_York
>>> 2009-11-01 04:00:00 Etc/GMT
>>> 2009-11-02 04:00:00 Etc/GMT
>>> 2009-11-02 05:00:00 Etc/GMT
>>>
>>> Is this a known bug?
>>>
>>> Ramsey
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSTimestamp bug in timestampByAddingGregorianUnits
      • From: Michael Halliday <email@hidden>
  • Prev by Date: Re: NSTimestamp bug in timestampByAddingGregorianUnits
  • Next by Date: Re: NSTimestamp bug in timestampByAddingGregorianUnits
  • Previous by thread: Re: NSTimestamp bug in timestampByAddingGregorianUnits
  • Next by thread: Re: NSTimestamp bug in timestampByAddingGregorianUnits
  • Index(es):
    • Date
    • Thread