• 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: time of the build
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: time of the build


  • Subject: Re: time of the build
  • From: David Durkee <email@hidden>
  • Date: Wed, 29 Apr 2015 08:00:34 -0500

I’m not concerned with the time, but I get the build date as an NSDate with this method:

- (NSDate*) buildDate
{
    NSString* dateStr = [NSString stringWithUTF8String: __DATE__];
    NSDateFormatter* dater = [[NSDateFormatter alloc] init];
    NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];

    [dater setLocale:enUSPOSIXLocale];
    [dater setDateFormat:@"MMM dd yyyy"];
    NSDate* date = [dater dateFromString: dateStr];
    return date;
}

David

> On Apr 29, 2015, at 6:39 AM, Torsten Curdt <email@hidden> wrote:
>
> I would like to embed the timestamp of the build into my executable.
>
> I know there is __DATE__ and __TIME__ but converting those into a timestamp
> at runtime isn't ideal.
>
> So I guess I somehow need to make the output of date +%s available to the
> preprocessor. But user defines allow only static values aren't they?
>
> I am not aware that a run script phase can export anything but files.
>
> How would you do this?
>
> Hope this is not too OT as this is more Xcode/build tools related.
> Happy to ask elsewhere if it is.
>
> cheers,
> Torsten
> _______________________________________________
>
> 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

_______________________________________________

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


  • Follow-Ups:
    • Re: time of the build
      • From: Torsten Curdt <email@hidden>
References: 
 >time of the build (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: time of the build
  • Next by Date: Re: New information. Was: Re: Weird UITableView problem
  • Previous by thread: Re: time of the build
  • Next by thread: Re: time of the build
  • Index(es):
    • Date
    • Thread