summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJanne Koskinen <janne.p.koskinen@digia.com>2009-12-23 13:33:49 (GMT)
committerJanne Koskinen <janne.p.koskinen@digia.com>2009-12-23 13:33:49 (GMT)
commit01cf310d21b17d8f57911ae194eaa0ca2472d155 (patch)
tree18cc0b85c785ecc0a59fc5d1a3ec8dc463ad007b /src
parentec19758c28efc6e1c712d44a6cb32ace38d3178d (diff)
downloadQt-01cf310d21b17d8f57911ae194eaa0ca2472d155.zip
Qt-01cf310d21b17d8f57911ae194eaa0ca2472d155.tar.gz
Qt-01cf310d21b17d8f57911ae194eaa0ca2472d155.tar.bz2
Revert "Daylight savings time for Symbian."
Reverted due to buildbreak on 3.2 ARMV5 Urel. This reverts commit 2a20705f874ddad55282f22fabfe30927729ae50.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/tools/qdatetime.cpp60
2 files changed, 23 insertions, 39 deletions
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 7f33791..9a15bf1 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -35,6 +35,4 @@ symbian: {
# Workaroud for problems with paging this dll
MMP_RULES -= PAGED
MMP_RULES *= UNPAGED
- # Timezone server
- LIBS += -ltzclient
}
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 240f0cf..db6435e 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -75,7 +75,6 @@
#if defined(Q_OS_SYMBIAN)
#include <e32std.h>
-#include <tz.h>
#endif
QT_BEGIN_NAMESPACE
@@ -3722,32 +3721,23 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
#elif defined(Q_OS_SYMBIAN)
// months and days are zero index based
_LIT(KUnixEpoch, "19700000:000000.000000");
+ TTimeIntervalSeconds utcOffset = User::UTCOffset();
TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC);
TTime epochTTime;
TInt err = epochTTime.Set(KUnixEpoch);
tm res;
if(err == KErrNone) {
TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC;
- TRAP(err,
- RTz tz;
- User::LeaveIfError(tz.Connect());
- CleanupClosePushL(tz);
- res.tm_isdst = tz.IsDaylightSavingOnL(*tz.GetTimeZoneIdL(),utcTTime);
- User::LeaveIfError(tz.ConvertToLocalTime(utcTTime));
- CleanupStack::PopAndDestroy(&tz));
- if (KErrNone == err) {
- TDateTime localDateTime = utcTTime.DateTime();
- res.tm_sec = localDateTime.Second();
- res.tm_min = localDateTime.Minute();
- res.tm_hour = localDateTime.Hour();
- res.tm_mday = localDateTime.Day() + 1; // non-zero based index for tm struct
- res.tm_mon = localDateTime.Month();
- res.tm_year = localDateTime.Year() - 1900;
- // Symbian's timezone server doesn't know how to handle DST before year 1997
- if (res.tm_year < 97)
- res.tm_isdst = -1;
- brokenDown = &res;
- }
+ utcTTime = utcTTime + utcOffset;
+ TDateTime utcDateTime = utcTTime.DateTime();
+ res.tm_sec = utcDateTime.Second();
+ res.tm_min = utcDateTime.Minute();
+ res.tm_hour = utcDateTime.Hour();
+ res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct
+ res.tm_mon = utcDateTime.Month();
+ res.tm_year = utcDateTime.Year() - 1900;
+ res.tm_isdst = 0;
+ brokenDown = &res;
}
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// use the reentrant version of localtime() where available
@@ -3822,27 +3812,23 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
#elif defined(Q_OS_SYMBIAN)
// months and days are zero index based
_LIT(KUnixEpoch, "19700000:000000.000000");
+ TTimeIntervalSeconds utcOffset = TTimeIntervalSeconds(0 - User::UTCOffset().Int());
TTimeIntervalSeconds tTimeIntervalSecsSince1Jan1970UTC(secsSince1Jan1970UTC);
TTime epochTTime;
TInt err = epochTTime.Set(KUnixEpoch);
tm res;
if(err == KErrNone) {
- TTime localTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC;
- RTz tz;
- if (KErrNone == tz.Connect()) {
- if (KErrNone == tz.ConvertToUniversalTime(localTTime)) {
- TDateTime utcDateTime = localTTime.DateTime();
- res.tm_sec = utcDateTime.Second();
- res.tm_min = utcDateTime.Minute();
- res.tm_hour = utcDateTime.Hour();
- res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct
- res.tm_mon = utcDateTime.Month();
- res.tm_year = utcDateTime.Year() - 1900;
- res.tm_isdst = (int)isdst;
- brokenDown = &res;
- }
- tz.Close();
- }
+ TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC;
+ utcTTime = utcTTime + utcOffset;
+ TDateTime utcDateTime = utcTTime.DateTime();
+ res.tm_sec = utcDateTime.Second();
+ res.tm_min = utcDateTime.Minute();
+ res.tm_hour = utcDateTime.Hour();
+ res.tm_mday = utcDateTime.Day() + 1; // non-zero based index for tm struct
+ res.tm_mon = utcDateTime.Month();
+ res.tm_year = utcDateTime.Year() - 1900;
+ res.tm_isdst = (int)isdst;
+ brokenDown = &res;
}
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// use the reentrant version of gmtime() where available