• 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: [NSDate] Bug in dateByAddingTimeInterval: on Mac OS X 10.5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSDate] Bug in dateByAddingTimeInterval: on Mac OS X 10.5


  • Subject: Re: [NSDate] Bug in dateByAddingTimeInterval: on Mac OS X 10.5
  • From: Jeff Johnson <email@hidden>
  • Date: Mon, 22 Nov 2010 10:35:14 -0600

Hi Stephane.

I believe that the header is mistaken. According to the documentation, dateByAddingTimeInterval: is "Available in Mac OS X v10.6 and later."

http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDate/dateByAddingTimeInterval:

However, I should note that the method does not seem to exist in either the 10.5 SDK for Xcode 3.2.4 or the 10.5 System headers. It only exists in the 10.6 SDK and the 10.6 System headers, where it has the incorrect availability macro.

-Jeff


On Nov 22, 2010, at 10:05 AM, Stephane Sudre wrote:

> According to the NSDate.h header:
>
> - (id)dateByAddingTimeInterval:(NSTimeInterval)ti
> AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
>
> Problem is when I run the following code on Mac OS X 10.5 on a
> PowerMac G5, I get the result listed below.
>
> #import <Foundation/Foundation.h>
>
> int main (int argc, const char * argv[]) {
>    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
>    NSLog(@"dateByAddingTimeInterval: %@",[[NSDate date]
> dateByAddingTimeInterval:24*60*60]);
>
>    NSLog(@"addTimeInterval: %@",[[NSDate date] addTimeInterval:24*60*60]);
>    [pool drain];
>    return 0;
> }
>
>
> $ ./TestAPIDate
> 2010-11-22 16:59:15.900 TestAPIDate[4192:10b]
> dateByAddingTimeInterval: 2020-10-13 09:58:31 +0200
> 2010-11-22 16:59:15.901 TestAPIDate[4192:10b] addTimeInterval:
> 2010-11-23 16:59:15 +0100
>
> So it looks like this API is broken on Mac OS X 10.5 and should not be
> said to be available for Mac OS X 10.5 in the 10.5 SDK Headers.
>
> Am I missing something obvious? (I will file a bug report later if I'm
> not missing anything).

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[NSDate] Bug in dateByAddingTimeInterval: on Mac OS X 10.5 (From: Stephane Sudre <email@hidden>)

  • Prev by Date: [NSDate] Bug in dateByAddingTimeInterval: on Mac OS X 10.5
  • Next by Date: Infinite Loop invoking super ?? -[NSDocument canCloseDocumentWithSelector:::]
  • Previous by thread: [NSDate] Bug in dateByAddingTimeInterval: on Mac OS X 10.5
  • Next by thread: Infinite Loop invoking super ?? -[NSDocument canCloseDocumentWithSelector:::]
  • Index(es):
    • Date
    • Thread