discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Serious NSCalendarDate bug


From: Andreas Höschler
Subject: Serious NSCalendarDate bug
Date: Wed, 24 Aug 2005 17:18:43 +0200

Hello all,

dateByAddingYears:months:days:hours:minutes:seconds:

does not work for us!

NSCalendarDate *dateA = [NSCalendarDate dateWithString:@"24.08.2005 13:59:59" calendarFormat:@"%d.%m.%Y %H:%M:%S"];
NSCalendarDate *dateB = [NSCalendarDate dateWithString:@"24.08.2005 14:00:16" calendarFormat:@"%d.%m.%Y %H:%M:%S"];
NSLog(@"%@", [dateA dateByAddingYears:0 months:0 days:0 hours:2 minutes:-2 seconds:-34]);
NSLog(@"%@", [dateB dateByAddingYears:0 months:0 days:0 hours:2 minutes:-2 seconds:-32]);

gives us

2005-08-24 17:12:37.000 DateTool[9797] 2005-08-24 15:57:25 +0200
2005-08-24 17:12:37.000 DateTool[9797] 2005-08-24 17:57:44 +0200

Where does the time shift of 2 hours come from? We have played with a bunch of offsets. The problem is easily reproducible. This occurs on Solaris. I have attached a test program. Is this bug platform related or a general (known) GNUstep bug?

Thanks,

Andreas

***********************************************************
#import <Foundation/Foundation.h>

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

// insert your code here
{
NSCalendarDate *dateA = [NSCalendarDate dateWithString:@"24.08.2005 13:59:59" calendarFormat:@"%d.%m.%Y %H:%M:%S"];
NSCalendarDate *dateB = [NSCalendarDate dateWithString:@"24.08.2005 14:00:16" calendarFormat:@"%d.%m.%Y %H:%M:%S"];
NSLog(@"%@", [dateA dateByAddingYears:1 months:-11 days:-30 hours:-22 minutes:-2 seconds:-34]);
NSLog(@"%@", [dateB dateByAddingYears:1 months:-11 days:-30 hours:-22 minutes:-2 seconds:-32]);
}


[pool release];
exit(0); // insure the process exit status is 0
return 0; // ...and make main fit the ANSI spec.
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]