summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2004-01-07 14:42:28 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2004-01-07 14:42:28 +0000
commitcd26d22ff4e7ea922f901b4cc9121928ee375cc6 (patch)
treee4a022825622a73ed905218670cd2bfaf32d1fe3 /unotools
parent9b3793185841cc81db38e28b5cfda92e300d0243 (diff)
INTEGRATION: CWS geordi2q12 (1.9.60); FILE MERGED
2004/01/06 14:30:29 hr 1.9.60.1: #111934#: merge CWS pp1numfor -> SRC680
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/i18n/calendarwrapper.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx
index 785cdedf27a3..2a1d4e693ab7 100644
--- a/unotools/source/i18n/calendarwrapper.cxx
+++ b/unotools/source/i18n/calendarwrapper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: calendarwrapper.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: vg $ $Date: 2003-04-24 11:01:26 $
+ * last change: $Author: rt $ $Date: 2004-01-07 15:42:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -294,10 +294,28 @@ void CalendarWrapper::setLocalDateTime( double nTimeInDays )
double nLoc = nTimeInDays - (double)(nZone + nDST1) / 60.0 / 24.0;
xC->setDateTime( nLoc );
sal_Int16 nDST2 = xC->getValue( i18n::CalendarFieldIndex::DST_OFFSET );
+ // If DSTs differ after calculation, we crossed boundaries. Do it
+ // again, this time using the DST corrected initial value for the
+ // real local time.
+ // See also localtime/gmtime conversion pitfalls at
+ // http://www.erack.de/download/timetest.c
if ( nDST1 != nDST2 )
{
nLoc = nTimeInDays - (double)(nZone + nDST2) / 60.0 / 24.0;
xC->setDateTime( nLoc );
+ // #i17222# If the DST onset rule says to switch from 00:00 to
+ // 01:00 and we tried to set onsetDay 00:00 with DST, the
+ // result was onsetDay-1 23:00 and no DST, which is not what we
+ // want. So once again without DST, resulting in onsetDay
+ // 01:00 and DST. Yes, this seems to be weird, but logically
+ // correct.
+ sal_Int16 nDST3 = xC->getValue(
+ i18n::CalendarFieldIndex::DST_OFFSET );
+ if ( nDST2 != nDST3 && !nDST3 )
+ {
+ nLoc = nTimeInDays - (double)(nZone + nDST3) / 60.0 / 24.0;
+ xC->setDateTime( nLoc );
+ }
}
}
}