#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

	NSDate *today = [NSDate date];
	NSCalendar *cal = [[NSCalendar alloc]
					   initWithCalendarIdentifier:NSGregorianCalendar];
	NSInteger thisYear = [[cal components:NSYearCalendarUnit fromDate:today] year];
	NSDateComponents *newYearsDayComp = [[NSDateComponents alloc] init];
	
	[newYearsDayComp setYear:thisYear + 1];
	[newYearsDayComp setMonth:1];
	[newYearsDayComp setDay:1];
	
	NSDate *newYearsDay = [cal dateFromComponents:newYearsDayComp];
	NSDateComponents *diffComp = [cal components:NSDayCalendarUnit fromDate:today toDate:newYearsDay options:0];
	
	NSLog(@"%d days remaining", [diffComp day]);
    [pool drain];
    return 0;
}
