New date allocation

Discussion in 'iOS Programming' started by AG!, May 21, 2009.

  1. AG! macrumors newbie

    Joined:
    May 21, 2009
    #1
    Hello,

    Im a new iphone developer so please be patient with me.

    The problem is that I have a function like this

    -(void)buttonPressed {

    NSDate someDate = [[NSDate alloc] init];

    NSlog(@"Date: %d", someDate);

    }

    NOTE: Im not in front of my MAC at the moment so my code may differ slightly.

    The issue is that when ever I press the button that fires the buttonPressed method, a time is printed, however, it does not always increase (though it should theoretically). Sometimes is decreases (i.e. goes back in time). Does anybody know of a solution or the problem Im facing?

    Thanks
     
  2. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
  3. yrvaken2 macrumors newbie

    Joined:
    Sep 15, 2008
    #3
    Try:

    Code:
    	NSDate *date = [NSDate date];
    	NSLog(@"date: %@", date);
    
     

Share This Page