2003-09-08 21:42:38.591 age[3987] Age = 22 years, -1 months, 15 days
(because it uses 'todays date' to do the calculation, its probably worth noting that I ran it on 2003/9/8)
Is there something wrong in the program, or is that a bug?
Rob
#include <Foundation/Foundation.h>
int main (int argc, char **argv)
{
NSArray *args;
NSAutoreleasePool *pool;NSString *dateString; NSCalendarDate *birthday, *todaysDate;
int years=0, months=0, days=0;
pool = [NSAutoreleasePool new]; args = [[NSProcessInfo processInfo] arguments];
if([args count] < 1)
{
NSLog(@"I think you forgot something");
[pool release];
exit(0);
}dateString = [NSString stringWithString: [args objectAtIndex: 1]];
birthday = [NSCalendarDate dateWithString: dateString calendarFormat: @"%Y/%m/%d"];
todaysDate = [NSCalendarDate calendarDate];
[todaysDate years: &years months: &months days: &days hours: NULL
minutes: NULL seconds: NULL sinceDate: birthday];
NSLog(@"Age = %i years, %i months, %i days", years, months, days);
[pool release]; exit(1); }
_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
