mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Fix bug #18088
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23950 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2e258c4d7c
commit
9f4296a8b2
3 changed files with 16 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2006-10-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSCalendarDate: when adding offset to a date, work in
|
||||
the timezone for the date rather than in GMT ... fixes bug #18088
|
||||
|
||||
2006-10-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSPrivate.m:
|
||||
|
|
|
@ -68,7 +68,7 @@ extern "C" {
|
|||
second: (unsigned int)second
|
||||
timeZone: (NSTimeZone*)aTimeZone;
|
||||
|
||||
// Retreiving Date Elements
|
||||
// Retrieving Date Elements
|
||||
- (int) dayOfCommonEra;
|
||||
- (int) dayOfMonth;
|
||||
- (int) dayOfWeek;
|
||||
|
|
|
@ -2378,13 +2378,15 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
NSTimeInterval newOffset;
|
||||
int i, year, month, day, hour, minute, second, mil;
|
||||
|
||||
oldOffset = offset(_time_zone, self);
|
||||
/*
|
||||
* Break into components in GMT time zone.
|
||||
/* Apply timezone offset to _seconds_since_ref from GMT to local time,
|
||||
* then break into components in local time zone.
|
||||
*/
|
||||
GSBreakTime(_seconds_since_ref, &year, &month, &day, &hour, &minute,
|
||||
&second, &mil);
|
||||
oldOffset = offset(_time_zone, self);
|
||||
s = _seconds_since_ref + oldOffset;
|
||||
GSBreakTime(s, &year, &month, &day, &hour, &minute, &second, &mil);
|
||||
|
||||
/* Apply required offsets to get new local time.
|
||||
*/
|
||||
while (years != 0 || months != 0 || days != 0
|
||||
|| hours != 0 || minutes != 0 || seconds != 0)
|
||||
{
|
||||
|
@ -2473,9 +2475,11 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
}
|
||||
|
||||
/*
|
||||
* Reassemble in GMT time zone.
|
||||
* Reassemble and apply original timezone offset to get
|
||||
* _seconds_since_ref back to GMT.
|
||||
*/
|
||||
s = GSTime(day, month, year, hour, minute, second, mil);
|
||||
s -= oldOffset;
|
||||
c = [NSCalendarDate alloc];
|
||||
c->_calendar_format = cformat;
|
||||
c->_time_zone = RETAIN([self timeZone]);
|
||||
|
|
Loading…
Reference in a new issue