Challenge decimals


Hey, I just finished the challenge but received the answer as 666550222.860126 seconds. Since I both have no actually how many seconds since my birthday (I’m born in 1990), and I’m not sure if/how I’ve gone wrong, I was wondering if someone could check my code:

[code]#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])

@autoreleasepool {
    NSDateComponents *comps = [[NSDateComponents alloc] init];
    [comps setYear:1990];
    [comps setMonth:12];
    [comps setDay:24];
    [comps setHour:8];
    [comps setMinute:0];
    [comps setSecond:0];
    NSCalendar *g = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDate *dateOfBirth = [g dateFromComponents:comps];
    NSLog(@"My birthday is %@", dateOfBirth);
    NSDate *now = [NSDate date];
    double seconds = [now timeIntervalSinceDate:dateOfBirth];
    NSLog(@"It has been %f seconds since my birthday", seconds);

return 0;



$ perl -e 'use Date::Parse; my $born = str2time(“1990-12-24 08:00”); my $now = time(); printf("%d\n", $now - $born);'

Looks good to me.


You can remove your decimal by using %.0f instead of %f in your last NSLog.