commit 45fd7b3e13161acf691f48fd447e12e6acb4d8f4
Author: Rhys Weatherley <rhys.weatherley@nokia.com>
Date:   Tue Mar 24 09:29:05 2009 +1000

    Pull across changes from before the history cut.

diff --git a/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp b/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp
index a1424f4..7d195d5 100644
--- a/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp
+++ b/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp
@@ -104,3 +104,10 @@ QDateTime dateTime = QDateTime::fromString("130", "Mm"); // invalid
 QDateTime dateTime = QDateTime::fromString("1.30.1", "M.d.s");
 // dateTime is January 30 in 1900 at 00:00:01.
 //! [14]
+
+//! [15]
+QDateTime dt(ui->dateTimeEdit->dateTime()); //current datetime
+dt.setTimeZone(fromTimeZone);
+
+QDateTime convertDt = dt.toTimeZone(toTimeZone);
+//!1 [15]
diff --git a/src/corelib/tools/qconstcstring.h b/src/corelib/tools/qconstcstring.h
new file mode 100644
index 0000000..6531778
--- /dev/null
+++ b/src/corelib/tools/qconstcstring.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** This file is part of the $PACKAGE_NAME$.
+**
+** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+**
+** $QT_EXTENDED_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCONSTCSTRING_H
+#define QCONSTCSTRING_H
+
+class QConstCString
+{
+public:
+    QConstCString()
+    : m_str(0), m_length(0)
+    {
+    }
+
+    QConstCString(const QConstCString &other)
+    : m_str(other.m_str), m_length(other.m_length)
+    {
+    }
+
+    QConstCString(const char *str)
+    : m_str(str), m_length(::strlen(str))
+    {
+    }
+
+    QConstCString(const char *str, int len)
+    : m_str(str), m_length(len)
+    {
+    }
+
+    char operator[](int pos) const
+    {
+        Q_ASSERT(pos < m_length);
+        return m_str[pos];
+    }
+
+    bool operator==(const QConstCString &other) const
+    {
+        return other.m_length == m_length &&
+               (0 == m_length ||
+                0 == ::memcmp(other.m_str, m_str, m_length));
+    }
+
+    bool operator<(const QConstCString &other) const
+    {
+        if(other.m_length != m_length)
+            return m_length < other.m_length;
+
+        return ::memcmp(m_str, other.m_str, m_length) < 0;
+    }
+
+    QConstCString &operator=(const QConstCString &other)
+    {
+        m_str = other.m_str;
+        m_length = other.m_length;
+        return *this;
+    }
+
+    QByteArray toByteArray() const
+    {
+        return QByteArray(m_str, m_length);
+    }
+
+    int length() const
+    {
+        return m_length;
+    }
+    const char * data() const
+    {
+        return m_str;
+    }
+
+    QConstCString left(int len) const
+    {
+        return QConstCString(m_str, qMin(len, m_length));
+    }
+
+    QConstCString mid(int pos, int len=-1) const
+    {
+        if(pos >= m_length)
+            return QConstCString(0, 0);
+
+        return QConstCString(m_str + pos,
+                             (len == -1)?
+                             (m_length - pos):qMin(len, m_length - pos));
+    }
+
+private:
+    const char * m_str;
+    int m_length;
+};
+
+#endif
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 781514c..c8f96b1 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -48,6 +48,9 @@
 #include "qdatetime.h"
 #include "qregexp.h"
 #include "qdebug.h"
+
+#include "qtimezone.h"
+
 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
 #include <windows.h>
 #endif
@@ -764,7 +767,7 @@ QString QDate::longDayName(int weekday)
 
     If the \a format is Qt::SystemLocaleShortDate or
     Qt::SystemLocaleLongDate, the string format depends on the locale
-    settings of the system. Identical to calling
+    settings of the system. Identical to calling4
     QLocale::system().toString(date, QLocale::ShortFormat) or
     QLocale::system().toString(date, QLocale::LongFormat).
 
@@ -2201,7 +2204,10 @@ int QTime::elapsed() const
 */
 QDateTime::QDateTime()
 {
-    d = new QDateTimePrivate;
+     d = new QDateTimePrivate;
+#ifndef QT_BOOTSTRAPPED
+     //    d->tz = QTimeZone::utc();
+#endif
 }
 
 
@@ -2215,6 +2221,9 @@ QDateTime::QDateTime(const QDate &date)
     d = new QDateTimePrivate;
     d->date = date;
     d->time = QTime(0, 0, 0);
+#ifndef QT_BOOTSTRAPPED
+    //  d->tz = QTimeZone::utc();
+#endif
 }
 
 /*!
@@ -2230,6 +2239,9 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec)
     d->date = date;
     d->time = date.isValid() && !time.isValid() ? QTime(0, 0, 0) : time;
     d->spec = (spec == Qt::UTC) ? QDateTimePrivate::UTC : QDateTimePrivate::LocalUnknown;
+#ifndef QT_BOOTSTRAPPED
+//    d->tz = (spec == Qt::UTC) ? QTimeZone::utc() : QTimeZone::current();
+#endif
 }
 
 /*!
@@ -2848,8 +2860,10 @@ bool QDateTime::operator<(const QDateTime &other) const
             return date1 < date2;
         return time1 < time2;
     }
+
 }
 
+
 /*!
     \fn bool QDateTime::operator<=(const QDateTime &other) const
 
@@ -3301,6 +3315,48 @@ void QDateTime::detach()
     qAtomicDetach(d);
 }
 
+/*!
+  Returns a QDateTime in the QTimeZone /a tz, using this QDateTime
+  Converts the current QDateTime to a QDateTime in the QTimeZone /a tz.
+
+    Example:
+    \snippet doc/src/snippets/code/src_corelib_tools_qdatetime.cpp 15
+
+*/
+#ifndef QT_BOOTSTRAPPED
+#ifndef QT_BUILD_QMAKE //qmake doesnt need timezone
+
+QDateTime QDateTime::toTimeZone(const QTimeZone &tz) const
+{
+    return d->tz.convert( QDateTime(d->date, d->time), tz);
+}
+
+bool QDateTime::isDst()
+{
+   if (d->tz.isValid())
+      return d->tz.isDst(QDateTime(d->date,  d->time));
+   else
+      return false;
+}
+
+/*!
+  Sets the current QDateTime to QTimeZone /a tz. If /a convertTime is false, it will not convert the time, default is to convert the time. Returns true if tz is valid.
+*/
+bool QDateTime::setTimeZone(const QTimeZone &tz) const
+{
+    d->tz = tz;
+    return d->tz.isValid();
+}
+
+/*!
+  Returns the QTimeZone for this QDateTime.
+*/
+QTimeZone QDateTime::getTimeZone() const
+{
+    return d->tz;
+}
+#endif
+#endif //bootstrapped
 /*****************************************************************************
   Date/time stream functions
  *****************************************************************************/
@@ -3486,6 +3542,8 @@ static bool hasUnquotedAP(const QString &f)
     return false;
 }
 
+
+
 #ifndef QT_NO_DATESTRING
 /*****************************************************************************
   Some static function used by QDate, QTime and QDateTime
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 3278297..c0bfc56 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -51,6 +51,11 @@ QT_BEGIN_NAMESPACE
 
 QT_MODULE(Core)
 
+#ifndef QT_BOOTSTRAPPED
+#ifndef QT_BUILD_QMAKE
+class QTimeZone;
+#endif
+#endif
 class Q_CORE_EXPORT QDate
 {
 public:
@@ -212,6 +217,7 @@ Q_DECLARE_TYPEINFO(QTime, Q_MOVABLE_TYPE);
 
 class QDateTimePrivate;
 
+
 class Q_CORE_EXPORT QDateTime
 {
 public:
@@ -278,14 +284,27 @@ public:
         else
             return currentDateTime().toUTC();
     }
-    
+
+#endif
+#ifndef QT_BOOTSTRAPPED
+#ifndef QT_BUILD_QMAKE
+    bool setTimeZone(const QTimeZone &tz) const;
+    QTimeZone getTimeZone() const;
+
+    QDateTime toTimeZone(const QTimeZone &tz) const;
+    bool isDst();
+#endif
 #endif
 
 private:
+
     friend class QDateTimePrivate;
     void detach();
     QDateTimePrivate *d;
 
+#ifndef QT_BOOTSTRAPPED
+	//    QTimeZone *timeZone;
+#endif
 #ifndef QT_NO_DATASTREAM
     friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &);
     friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &);
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index b2fb58d..de03106 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -63,6 +63,8 @@
 #endif
 #include "QtCore/qvector.h"
 
+#include "QtCore/qtimezone.h"
+
 
 #define QDATETIMEEDIT_TIME_MIN QTime(0, 0, 0, 0)
 #define QDATETIMEEDIT_TIME_MAX QTime(23, 59, 59, 999)
@@ -97,6 +99,11 @@ public:
       The offset in seconds. Applies only when timeSpec() is OffsetFromUTC.
      */
     int utcOffset;
+#ifndef QT_BOOTSTRAPPED
+#ifndef QT_BUILD_QMAKE //qmake doesnt need timezone
+	QTimeZone tz;
+#endif
+#endif
 
     Spec getLocal(QDate &outDate, QTime &outTime) const;
     void getUTC(QDate &outDate, QTime &outTime) const;
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
new file mode 100644
index 0000000..2d5b1c3
--- /dev/null
+++ b/src/corelib/tools/qtimezone.cpp
@@ -0,0 +1,929 @@
+/****************************************************************************
+ **
+ ** This file is part of the $PACKAGE_NAME$.
+ **
+ ** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+ **
+ ** $QT_EXTENDED_DUAL_LICENSE$
+ **
+ ****************************************************************************/
+#include <qtimezone.h>
+
+
+#include <QDateTime>
+#include <QDebug>
+#include <QMap>
+#include <QHash>
+#include <QStringList>
+#include <QtGlobal>
+
+#include <QtCore/qdatetime.h>
+#include <QtCore/qobject.h>
+
+#include "qconstcstring.h" // ??
+#include "qtimezone_p.h"
+
+#include <stdlib.h>
+#include <time.h>
+
+
+/*******************************************************************
+ *
+ * QTimeZonePrivate
+ *
+ *******************************************************************/
+#ifndef QT_BOOTSTRAPPED
+
+static QString toHMS(qint32 seconds)
+{
+   QString hms;
+
+   if (seconds > 0)
+      hms.append('-');
+   else
+      seconds *= -1;
+
+   qint32 hours = seconds / (60*60);
+   hms += QString::number(hours);
+
+   seconds = seconds % (60*60);
+   qint32 minutes = seconds / 60;
+   if (minutes > 0) {
+      hms.append(':');
+      if (minutes < 10)
+         hms.append('0');
+
+      QString::number(minutes);
+   }
+
+   seconds = seconds % 60;
+   if (seconds > 0) {
+      hms.append(':');
+      if (minutes < 10)
+         hms.append('0');
+
+      hms.append(QString::number(seconds));
+   }
+
+   return hms;
+}
+
+
+QString QTimeZonePrivate::sZonePath(0);
+
+QString QTimeZonePrivate::sZoneFile(0);
+
+QTimeZonePrivate::QTimeZonePrivate( QString idLocation )
+   : loc(0), dat(0), ident(idLocation)
+{
+   //  tzDateTime = QDateTime::currentDateTime());
+}
+
+/*******************************************************************
+ *
+ * QTimeZoneData
+ *
+ *******************************************************************/
+
+QTimeZoneData *QTimeZoneData::null = new QTimeZoneData();
+
+
+QTimeZoneData::QTimeZoneData( const QString & loc )
+   : mId( loc ),
+     mDstRule( false )
+{
+   getSystemTimeZoneData(loc);
+}
+
+bool QTimeZoneData::matchAbbrev( const QDateTime &c,
+                                 QString standardAbbrev,
+                                 QString daylightAbbrev ) const
+{
+   if ( !isValid() )
+      return false;
+
+   ttinfo transInfo = timeTypes[ findTimeTypeIndex( c, false ) ];
+
+   if ( mDstRule )
+      return ( daylightAbbrev == abbreviations[ transInfo.abbreviationIndex ] );
+
+   return ( standardAbbrev == abbreviations[ transInfo.abbreviationIndex ] );
+}
+
+
+bool QTimeZoneData::matchTime( const QDateTime &c,
+                               long utcOffset, bool isdst ) const
+{
+   if ( !isValid() )
+      return false;
+
+   ttinfo transInfo = timeTypes[ findTimeTypeIndex( c, false ) ];
+
+   return transInfo.isDst == isdst && utcOffset == transInfo.utcOffset;
+}
+
+
+bool QTimeZoneData::isValid() const
+{
+   return (transitionTimes.count() > 0) || (timeTypes.count() > 0);
+}
+
+int QTimeZoneData::findTranstionTimeIndex( const QDateTime & c, bool utc ) const
+{
+   QDateTime ct = c;
+   ct.setTimeSpec(Qt::UTC);
+
+   for ( int i = 0; i < (int)transitionTimes.count(); ++i ) {
+
+      transitionInfo transTime = transitionTimes[i];
+      ttinfo transInfo = timeTypes[ transTime.timeTypeIndex ];
+
+      QDateTime thisItTime = QDateTime::fromTime_t(transTime.time);
+
+      // if comparing with utc, then shift the it time to utc
+      if ( !utc )
+         thisItTime = thisItTime.addSecs( transInfo.utcOffset );
+
+//      qWarning() <<"QTimeZoneData::findTranstionTimeIndex" << thisItTime << ct << "DST?" << transInfo.isDst << i;
+
+      if(thisItTime > ct) {
+         // gone one too far; we've passed it. return the previous one, if
+         // it exists
+         if ( i > 0 )
+            return i-1;
+         return i;
+      }
+   }
+   // must be the last index
+   return transitionTimes.count()-1;
+}
+
+int QTimeZoneData::findTimeTypeIndex( const QDateTime & c, bool utc ) const
+{
+   int transIndex = findTranstionTimeIndex( c, utc );
+//    qWarning() << "QTimeZoneData::findTimeTypeIndex" << transIndex;
+
+   if ( transIndex < 0 )
+      return 0;
+   return transitionTimes[ transIndex ].timeTypeIndex;
+}
+
+QString QTimeZoneData::standardAbbreviation() const
+{
+   QDateTime dt = QDateTime::currentDateTime();
+   int transIndex = findTranstionTimeIndex( dt, false );
+
+   while ( transIndex >= 0 ) {
+      int timeIndex = transitionTimes[ transIndex ].timeTypeIndex;
+      if ( !timeTypes[ timeIndex ].isDst )
+         return abbreviations[ timeTypes[ timeIndex ].abbreviationIndex ];
+
+      transIndex--;
+   }
+   return QString();
+}
+
+QString QTimeZoneData::dstAbbreviation() const
+{
+   QDateTime dt = QDateTime::currentDateTime();
+   int transIndex = findTranstionTimeIndex( dt, false );
+
+   while ( transIndex >= 0 ) {
+      int timeIndex = transitionTimes[ transIndex ].timeTypeIndex;
+      if ( timeTypes[ timeIndex ].isDst )
+         return abbreviations[ timeTypes[ timeIndex ].abbreviationIndex ];
+      transIndex--;
+   }
+   return QString();
+}
+
+bool QTimeZoneData::isDaylightSavings( const QDateTime & c ) const
+{
+   int timeIndex = findTimeTypeIndex( c, false );
+//    qWarning() << "QTimeZoneData::isDaylightSavings" << timeIndex;
+
+   return timeTypes[ timeIndex ].isDst;
+}
+
+qint32 QTimeZoneData::utcOffSet( const QDateTime & c ) const
+{
+   ttinfo transInfo = timeTypes[ findTimeTypeIndex( c, false ) ];
+   return transInfo.utcOffset;
+}
+
+////////////////////////////
+QDateTime QTimeZoneData::toUtc( const QDateTime &thisT ) const
+{
+    QDateTime dt(thisT.date(), thisT.time() /*, Qt::UTC*/);
+
+   if ( !isValid() ) {
+      qWarning("QTimeZoneData::toUtc invalid");
+      return QDateTime();
+   }
+   // find the appropriate utc time
+   int timeIndex = findTimeTypeIndex( dt, false );
+
+   int tzOffset = timeTypes[ timeIndex ].utcOffset;
+//   qWarning() << "timeIndex" << timeIndex << tzOffset << tzOffset/3600;
+
+   dt = dt.addSecs( -1 * tzOffset );
+   dt.setTimeSpec(Qt::UTC);
+
+//   qWarning() << "QTimeZoneData::toUtc" << thisT << dt;
+
+   return dt;
+}
+
+QDateTime QTimeZoneData::fromUtc( const QDateTime &utc ) const
+{
+   QDateTime dt(utc.date(), utc.time()/*, Qt::UTC*/);
+   if ( !isValid() ) { qWarning("QTimeZoneData::fromUtc invalid"); return QDateTime(); }
+   // convert from utc to "this" timezone
+   int timeIndex = findTimeTypeIndex( dt, true );
+   int tzOffset =  timeTypes[ timeIndex ].utcOffset;
+//   qWarning() << tzOffset/3600;
+   QDateTime rv = dt.addSecs( tzOffset );
+   rv.setTimeSpec(Qt::LocalTime);
+   return rv;
+}
+//////////////////////////////////
+
+QString QTimeZoneData::tzSetFormat(int stdIndex, int dstStartIndex, int dstEndIndex) const
+{
+   QString tz;
+
+   if (stdIndex == -1 || stdIndex > transitionTimes.count())
+      return tz;
+
+   // standard time
+   const ttinfo &stdTime = timeTypes[transitionTimes[stdIndex].timeTypeIndex];
+   if (stdTime.isDst) {
+      qWarning() << "stdIndex points to DST time.";
+      return tz;
+   }
+
+   if (abbreviations[stdTime.abbreviationIndex].isEmpty())
+      tz += "STD";
+   else
+      tz += abbreviations[stdTime.abbreviationIndex];
+   tz += toHMS(stdTime.utcOffset);
+
+   // daylight savings time, if applicable
+   if (dstStartIndex == -1 || dstStartIndex > transitionTimes.count())
+      return tz;
+
+   if (dstEndIndex == -1 || dstEndIndex > transitionTimes.count())
+      return tz;
+
+   const ttinfo &dstTimeStart = timeTypes[transitionTimes[dstStartIndex].timeTypeIndex];
+   if (!dstTimeStart.isDst) {
+      qWarning() << "dstStartIndex points to STD time.";
+      return tz;
+   }
+
+   const ttinfo &dstTimeEnd = timeTypes[transitionTimes[dstEndIndex].timeTypeIndex];
+   if (dstTimeEnd.isDst) {
+      qWarning() << "dstEndIndex points to DST time.";
+      return tz;
+   }
+
+   if (abbreviations[dstTimeStart.abbreviationIndex].isEmpty())
+      tz += "DST";
+   else
+      tz += abbreviations[dstTimeStart.abbreviationIndex];
+
+   tz += toHMS(dstTimeStart.utcOffset);
+   tz += ',';
+
+   QDateTime dstStart = QDateTime::fromTime_t(transitionTimes[dstStartIndex].time).addSecs(stdTime.utcOffset);
+   QDateTime dstEnd =  QDateTime::fromTime_t(transitionTimes[dstEndIndex].time).addSecs(dstTimeStart.utcOffset);
+
+   tz += QString::number(dstStart.date().dayOfYear() - 1);
+   tz += dstStart.time().toString("/hh:mm:ss");
+   tz += ',';
+   tz += QString::number(dstEnd.date().dayOfYear() - 1);
+   tz += dstEnd.time().toString("/hh:mm:ss");
+
+   return tz;
+}
+
+QString QTimeZoneData::tzSetFormat(const QDateTime &dt) const
+{
+   int transIndex = findTranstionTimeIndex(dt, true);
+
+   if (timeTypes[transitionTimes[transIndex].timeTypeIndex].isDst) {
+      // currently in DST use transIndex+1 as STD
+      return tzSetFormat(transIndex+1, transIndex, transIndex+1);
+   } else {
+      // currently in STD use transIndex+1 and transIndex+2 to calculate DST
+      return tzSetFormat(transIndex, transIndex+1, transIndex+2);
+   }
+}
+
+/*******************************************************************
+ *
+ * QTimeZoneLocation
+ *
+ *******************************************************************/
+QTimeZoneLocation::QTimeZoneLocation( const char *line )
+    : mLat(0), mLon(0)
+{
+   getSystemTimeZoneLocation(line);
+}
+
+
+int QTimeZoneLocation::calcLat(const QConstCString &latStr) const
+{
+   int deg, min, sec;
+   int sign = 1;
+   if ( latStr[0] == '-' )
+      sign = -1;
+   deg = (latStr[1] - '0') * 10 + (latStr[2] - '0');
+   min = (latStr[3] - '0') * 10 + (latStr[4] - '0');
+
+   //deg = latStr.mid(1, 2).toInt();
+   //min = latStr.mid(3, 2).toInt();
+   sec = 0;
+   if ( latStr.length() == 7 )
+      sec = (latStr[5] - '0') * 10 + (latStr[6] - '0');
+//      sec = latStr.mid(5, 2).toInt();
+   return sign*deg*3600 + sign*min*60 + sign*sec;
+}
+
+int QTimeZoneLocation::calcLon(const QConstCString &lonStr) const
+{
+   int deg, min, sec;
+
+   int sign = 1;
+   if ( lonStr[0] == '-' )
+      sign = -1;
+
+   deg = (lonStr[1] - '0') * 100 + (lonStr[2] - '0') * 10 + (lonStr[3] - '0');
+   min = (lonStr[4] - '0') * 10 + (lonStr[5] - '0');
+   // deg = lonStr.mid(1, 3).toInt();
+   //min = lonStr.mid( 4, 2 ).toInt();
+   sec = 0;
+   if ( lonStr.length() == 8 )
+      sec = (lonStr[6] - '0') * 10 + (lonStr[7] - '0');
+//      sec = lonStr.mid( 6, 2 ).toInt();
+
+   return sign*deg*3600 + sign*min*60 + sign*sec;
+}
+
+int QTimeZoneLocation::latitude() const
+{
+   return mLat;
+}
+
+int QTimeZoneLocation::longitude() const
+{
+   return mLon;
+}
+
+QString QTimeZoneLocation::description() const
+{
+   return  mDescription.constData();
+}
+
+QString QTimeZoneLocation::countryCode() const
+{
+   return mCountryCode;
+}
+
+QByteArray QTimeZoneLocation::id() const
+{
+   return mId;
+}
+
+
+/*******************************************************************
+ *
+ * QTzCache
+ *
+ *******************************************************************/
+
+QTzCache *QTzCache::sInstance = NULL;
+
+QTzCache &QTzCache::instance()
+{
+
+   if ( !sInstance ) {
+      sInstance = new QTzCache();
+   }
+
+   return *sInstance;
+}
+
+QTzCache::QTzCache()
+{
+   QTimeZoneLocation::load( mLocationDict );
+}
+
+QTimeZoneData *QTzCache::data( const QString &id )
+{
+   if ( id.isEmpty() )
+      return QTimeZoneData::null;
+
+//   qWarning() << "Find XXXXXXXXXXXXX " << mDataDict.count() << id;
+
+   QMap<QString,QTimeZoneData*>::const_iterator it = mDataDict.find(id);
+//    for (int i = 0; i < mDataDict.size(); ++i) {
+//        qWarning() << "Found it!"<< mDataDict.key(*it);
+
+//    }
+
+   if (it != mDataDict.end())
+      return *it;
+
+//    qWarning() << "QTzCache new QTimeZoneData XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
+
+   QTimeZoneData *d = new QTimeZoneData( id );
+   if ( !d->isValid() ) {
+      qWarning("QTimeZone::data Can't create a valid data object for '%s'", (const char *)id.toLatin1() );
+      delete d;
+      return QTimeZoneData::null;
+   }
+//    qWarning() << "QTzCache::data" << "insert" << id;
+   mDataDict.insert( id, d );
+
+   return d;
+}
+
+QTimeZoneData *QTzCache::findFromMinutesEast(QDateTime t, int mineast, bool isdst)
+{
+   QMap<QString,QTimeZoneData*>::const_iterator it = mDataDict.begin();
+   while ( it != mDataDict.end()) {
+      if ( (*it)->matchTime(t,mineast*60,isdst) )
+         return *it;
+      ++it;
+   }
+   return 0;
+}
+
+QTimeZoneLocation *QTzCache::location( const QString &id )
+{
+//   qWarning() << "QTzCache::location" << id;
+   if ( id.isEmpty() )
+      return 0;
+   QTimeZoneLocation * l = mLocationDict[ id.toAscii() ];
+   return l;
+}
+
+QStringList QTzCache::ids()
+{
+   QStringList rv;
+   foreach(QByteArray key, mLocationDict.keys())
+      rv << key;
+   return rv;
+}
+
+QTimeZoneLocation *QTimeZonePrivate::location() const
+{
+   if ( !loc )
+      loc = QTzCache::instance().location( ident );
+   return loc;
+}
+
+QTimeZoneData *QTimeZonePrivate::data() const
+{
+   if ( !dat )
+      dat = QTzCache::instance().data( ident );
+   return dat;
+}
+
+/*******************************************************************
+ *
+ * QTimeZone
+ *
+ *******************************************************************/
+
+/*!
+  \class QTimeZone
+  \inpublicgroup QtBaseModule
+
+  \brief The QTimeZone class provides access to time zone data.
+
+  QTimeZone provides access to timezone data and conversion between
+  dates and times in different time zones.
+
+  A time zone is a region of the world that has adopted the same standard time,
+  including conventions on Daylight Saving or Summer time adjustments.
+
+  Each time zone is specified by a unique identifier. A set of such identifiers is known
+  to the system, and can be found using ids().
+
+  Conversions between time zones can either be done via UTC, using fromUtc() and toUtc(),
+  or directly with convert(), fromCurrent(), or toCurrent().
+
+  Each time zone is in a greater area() and has an associated city() that observes
+  the standard. This city is not necessarily the capital, just a well-known city
+  in the area. More than one city in an area may observe identical standards, yet
+  they will appear as distinct time zones. The countyCode() of the country containing
+  the time zone is also available.
+
+  A QTimeZone either isValid() or is not valid. The default constructor creates an
+  invalid QTimeZone.
+  Note that some features of QTimeZone may not be available on non-POSIX platforms.
+
+  \ingroup time
+
+  \sa QtopiaApplication::timeChanged()
+*/
+
+/*!
+  Construct an invalid time zone.
+*/
+QTimeZone::QTimeZone()
+{
+   d = new QTimeZonePrivate(QString());
+}
+
+/*!
+  Construct a QTimeZone for location \a locId. The time zone isValid() if
+  \a locId is a valid time zone identifier in the list of ids().
+*/
+QTimeZone::QTimeZone( const QString & locId )
+{
+    d = new QTimeZonePrivate(locId);
+}
+
+/*!
+  Constructs a copy of the \a other QTimeZone.
+*/
+QTimeZone::QTimeZone( const QTimeZone & other )
+{
+   d = new QTimeZonePrivate(other.d->id());
+}
+
+/*!
+  Destruct QTimeZone.
+*/
+QTimeZone::~QTimeZone()
+{
+   delete d; d = 0;
+}
+
+/*!
+  Sets the time zone id of this QTimeZone to \a id.
+*/
+void QTimeZone::setId( const QString &id )
+{
+   d->setId(id);
+}
+
+/*!
+  Assign time zone \a from to this time zone.
+*/
+QTimeZone &QTimeZone::operator=( const QTimeZone &from)
+{
+   d->setId(from.d->id());
+   return *this;
+}
+
+/*!
+  Returns true if \a c is equal to this, otherwise false.
+*/
+bool QTimeZone::operator==( const QTimeZone &c) const
+{
+   return (d->id() == c.d->id());
+}
+
+/*!
+  Returns true if \a c is not equal to this, otherwise false.
+*/
+bool QTimeZone::operator!=( const QTimeZone &c) const
+{
+   return (d->id() != c.d->id());
+}
+
+/*!
+  Returns a time zone that, at time \a t, is \a mineast minutes ahead of GMT,
+  and is observing Daylight Time according to \a isdst.
+
+  Usually, the returned timezone will be a UNIX GMT time zone offset
+  (eg. "GMT-10" for 10 hours East of GMT), however, if no such timezone
+  exists (eg. for half-hour time zones), a city time zone will be returned.
+*/
+QTimeZone QTimeZone::findFromMinutesEast(const QDateTime& t, int mineast, bool isdst)
+{
+   if ( mineast % 60 == 0 ) {
+      QString s;
+      s.sprintf("Etc/GMT%+d",-mineast/60);
+      return QTimeZone(s);
+   }
+
+   // Fallback: find non-standard city
+   QTimeZoneData *data = QTzCache::instance().findFromMinutesEast(t,mineast,isdst);
+   return QTimeZone(data ? data->id() : QString());
+}
+
+/*!
+  Return a time zone located at the UTC reference.
+*/
+QTimeZone QTimeZone::utc()
+{
+   return QTimeZone("UTC");
+}
+
+/*!
+  Return the current system UTC date and time.
+*/
+//FIXME to QDateTime  QDateTime::fromTime_t
+
+// QDateTime QTimeZone::currentUtcDateTime()
+// {
+//     return QDateTime::fromTime_t/*QTimeZonePrivate::setUtcTime*/( /*(time_t)*/time(0) );
+// }
+
+
+
+
+
+////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////
+/*!
+  Returns the date and time \a dt in this time zone as
+  a date and time in UTC.
+*/
+
+QDateTime QTimeZone::toUtc( const QDateTime &dt ) const
+{
+   QTimeZoneData *data = d->data();
+   return data->toUtc( dt );
+}
+
+
+/*!
+  Returns the UTC date and time \a utc as a date and time in this time zone.
+*/
+
+QDateTime QTimeZone::fromUtc( const QDateTime &utc ) const
+{
+   QTimeZoneData *data = d->data(); //create QTzCache instance
+   return data->fromUtc( utc );
+}
+
+
+
+
+/*!
+  Returns the date and time \a dt in this time zone as the date and time
+  in the current system time zone.
+
+  \sa current()
+*/
+//FIXME redundant QDateTime::toLocal
+//QDateTime QTimeZone::toCurrent( const QDateTime &dt ) const
+//{
+//    QTimeZone curTz = current();
+//    return curTz.convert( dt, *this );
+//}
+
+/*!
+  Returns the date and time \a curT in the current time zone as the
+  date and time in this time zone.
+
+  \sa current()
+*/
+//QDateTime QTimeZone::fromCurrent( const QDateTime &curT ) const
+//{
+//    QTimeZone curTz = current();
+//    return convert( curT, curTz );
+//}
+
+
+
+
+/*!
+  Return the date and time \a dt in time zone \a dtTz as the date and time
+  in this time zone.
+*/
+
+QDateTime QTimeZone::convert( const QDateTime &dt, const QTimeZone &dtTz ) const
+{
+   d->data()->setTzDateTime(dt);
+   QDateTime utc = toUtc(dt);
+   return dtTz.fromUtc(utc);
+}
+
+
+
+
+//I would expect QDateTime to be modified to hold a QTimeZone internally, so
+//that the API would be:
+//QTimeZone timeZone() const
+//QDateTime QDateTime::toTimeZone(const QTimeZone &tz) const;
+
+// /*!
+//   Gets the UTC offset in number of hours for the date time /a c between this timezone and UTC.
+//   East of UTC would be negative (i.e. -9.5 UTC) and Westd
+
+qreal QTimeZone::getUTCOffset(const QDateTime &c) const
+{
+   QTimeZoneData *data = d->data();
+   return (float)data->utcOffSet(c)/60/60;
+}
+/*!
+  Returns true if the date time /a c in this timezone is under daylight saving rules, otherwise false;
+*/
+bool QTimeZone::isDst(const QDateTime &c) const
+{
+   QTimeZoneData *data = d->data();
+   bool dlt = data->isDaylightSavings(c);
+//   qWarning() <<dlt;
+   return dlt;
+}
+
+
+QString lastZoneRead;
+QString lastLocRead;
+
+
+/*!
+  Return the time zone identifier, for example, Europe/London
+*/
+QString QTimeZone::id() const
+{
+   return d->id();
+}
+
+/*!
+  Returns true if this is a valid time zone, otherwise false.
+*/
+bool QTimeZone::isValid() const
+{
+   QTimeZoneData *data = d->data();
+   QTimeZoneLocation *loc = d->location();
+   if (d->id() == "UTC" && data->isValid())
+      return true;
+   return data->isValid() && loc && loc->isValid();
+}
+
+/*!
+  Returns the Daylight Savings Time (DST) time zone abbreviation.
+*/
+QString QTimeZone::dstAbbreviation() const
+{
+   QTimeZoneData *data = d->data();
+   return data->dstAbbreviation();
+}
+
+/*!
+  Returns the time zone abbreviation, e.g. EST
+*/
+QString QTimeZone::standardAbbreviation() const
+{
+   QTimeZoneData *data = d->data();
+   return data->standardAbbreviation();
+}
+
+/*!
+  Returns a list of all time zone ids known to the system.
+*/
+QStringList QTimeZone::ids()
+{
+   return QTzCache::instance().ids();
+}
+
+/*!
+  Returns the latitude of the city() of this timezone, in seconds of a degree.
+*/
+int QTimeZone::latitude() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->latitude();
+   return 0;
+}
+
+/*!
+  Returns the longitude of the city() of this timezone, in seconds of a degree.
+*/
+int QTimeZone::longitude() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->longitude();
+   return 0;
+}
+
+/*!
+  Returns the translated description of this time zone.
+*/
+QString QTimeZone::description() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->description();
+   return QString();
+}
+
+
+
+/*!
+  Returns the ISO 3166 2-character country code.
+*/
+// QString QTimeZone::countryCode()
+// {
+// #ifndef Q_OS_WIN
+//     QTimeZoneLocation *loc = d->location();
+//     if ( loc )
+//         return loc->countryCode();
+// #endif
+//     return QString();
+// }
+
+/*!
+  \internal
+  Returns the sum of the differences in longitude and latitude between
+  points in this and another timezone.
+*/
+// FIXME is this needed now?
+// int QTimeZone::distance( const QTimeZone &e ) const
+// {
+// #ifndef Q_OS_WIN
+//     QTimeZoneLocation *loc = d->location();
+//     QTimeZoneLocation *comp = e.d->location();
+//     if ( loc && comp )
+//         return loc->distance( *comp );
+// #else
+//     Q_UNUSED(e);
+// #endif
+//     return 0;
+// }
+
+/*!
+  Sets the system time zone to \a newtz.
+*/
+//void QTimeZone::setSystemTimeZone(const QString &newtz)
+//{
+//    QString tzEnv;
+//
+//#ifdef __UCLIBC__
+//    // uClibc does not support zoneinfo
+//    QTimeZone tz(newtz);
+//    tzEnv = tz.d->data()->tzSetFormat(utcDateTime());
+//
+//    QFile localTime("/etc/TZ");
+//    if (localTime.open(QIODevice::WriteOnly | QIODevice::Text)) {
+//        localTime.write(tzEnv.toLatin1().constData());
+//        localTime.write(QByteArray(1, '\n'));
+//        localTime.close();
+//    } else {
+//        qWarning() << "Cannot open" << localTime.fileName() << "for writing.";
+//    }
+//#else
+//    // for systems that support zoneinfo
+//    tzEnv = newtz;
+//
+//#if defined(QTOPIA_ZONEINFO_PATH)
+//    QString filename = QTOPIA_ZONEINFO_PATH + newtz;
+//#else
+//    QString filename = "/usr/share/zoneinfo/" + newtz;
+//#endif
+//    QFile localTime("/etc/localtime");
+//    if (localTime.exists())
+//        if (!localTime.remove())
+//            qWarning() << "localtime could not be removed";
+//
+//    if (!QFile::copy(filename, "/etc/localtime"))
+//        qWarning() << "Could not copy" << newtz<< "to localtime";
+//#endif
+//
+//    setenv("TZ", tzEnv.toLatin1().constData(), 1);
+//    tzset();
+//
+//    QSettings lconfig("Trolltech","locale");
+//    lconfig.beginGroup( "Location" );
+//    lconfig.setValue( "Timezone", newtz.toLatin1().constData() );
+//
+//    QFile timeZone("/etc/timezone");
+//    if (timeZone.open(QIODevice::WriteOnly | QIODevice::Text)) {
+//        timeZone.write(newtz.toLatin1().constData());
+//        localTime.close();
+//    } else {
+//        qWarning() << "Cannot open" << timeZone.fileName() << "for writing.";
+//    }
+//}
+
+/*!
+  Sets the application time zone to \a newtz.
+*/
+//void QTimeZone::setApplicationTimeZone(const QString &newtz)
+//{
+//    QString tzEnv;
+//
+//#ifdef __UCLIBC__
+//    QTimeZone tz(newtz);
+//    tzEnv = tz.d->data()->tzSetFormat(utcDateTime());
+//#else
+//    tzEnv = newtz;
+//#endif
+//
+//    setenv("TZ", tzEnv.toLatin1(), 1);
+//    tzset();
+//}
+
+//Q_IMPLEMENT_USER_METATYPE(QTimeZone)
+
+#endif //bootstrapped
diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h
new file mode 100644
index 0000000..8573f01
--- /dev/null
+++ b/src/corelib/tools/qtimezone.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** This file is part of the $PACKAGE_NAME$.
+**
+** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+**
+** $QT_EXTENDED_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTIMEZONE_H
+#define QTIMEZONE_H
+
+#include <QtCore/qstring.h>
+#include <QtCore/qdatastream.h>
+
+#ifndef QT_BOOTSTRAPPED
+
+Q_CORE_EXPORT
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+
+class QTimeZonePrivate;
+class QDateTime;
+
+class Q_CORE_EXPORT QTimeZone
+{
+public:
+    QTimeZone();
+    explicit QTimeZone( const QString &);
+    QTimeZone( const QTimeZone & );
+
+    ~QTimeZone();
+
+    bool isValid() const;
+
+    void setId( const QString &id );
+
+    QTimeZone &operator=( const QTimeZone &);
+    bool operator==( const QTimeZone &) const;
+    bool operator!=( const QTimeZone &) const;
+
+    /*! returns QDateTime in this timezone */
+//    /** /a dt is in this time zone */
+    QDateTime toUtc( const QDateTime &thisT ) const;
+    QDateTime fromUtc( const QDateTime &utc ) const;
+//    // convert the /a dt which is in the timezone /a tz to "this" timezone
+    QDateTime convert( const QDateTime &dt, const QTimeZone &dtTz ) const;
+
+    static QTimeZone current();
+    static QTimeZone utc();
+    static QTimeZone findFromMinutesEast(const QDateTime& t, int mineast, bool isdst);
+
+    int latitude() const; // in seconds 
+    int longitude() const; // in seconds 
+
+    QString name() const;
+
+    QString dstAbbreviation() const;
+    QString standardAbbreviation() const;
+
+    QString description() const;
+    QString area() const;
+    QString city() const;
+    QString id() const;
+	//    QString countryCode();
+	//    int distance( const QTimeZone &e ) const;
+
+    qreal getUTCOffset( const QDateTime & c ) const;
+    bool isDst(const QDateTime & c ) const;
+
+    static QStringList ids();
+
+//    static void setSystemTimeZone(const QString &newtz);
+//    static void setApplicationTimeZone(const QString &newtz);
+
+private:
+    QTimeZonePrivate *d;
+};
+Q_DECLARE_TYPEINFO(QTimeZone, Q_MOVABLE_TYPE);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+#endif
+#endif
diff --git a/src/corelib/tools/qtimezone_p.h b/src/corelib/tools/qtimezone_p.h
new file mode 100644
index 0000000..e2e7493
--- /dev/null
+++ b/src/corelib/tools/qtimezone_p.h
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** This file is part of the $PACKAGE_NAME$.
+**
+** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+**
+** $QT_EXTENDED_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTIMEZONE_P_H
+#define QTIMEZONE_P_H
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists purely as an
+// implementation detail.  This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+//#include "private/qobject_p.h"
+#include "QtCore/qtimezone.h"
+#include "qconstcstring.h" // ??
+
+#ifndef QT_BOOTSTRAPPED
+
+QT_BEGIN_NAMESPACE
+
+class QTimeZoneLocation;
+class QTimeZoneData;
+#include <QVector>
+
+
+class QTimeZonePrivate
+{
+   mutable QTimeZoneLocation *loc;
+   mutable QTimeZoneData *dat;
+   QString ident;
+
+public:
+   QTimeZonePrivate( QString idLocation );
+   const QString& id() const { return ident; }
+   void setId(const QString id) { ident=id; loc=0; dat=0; }
+
+   QTimeZoneLocation *location() const;
+   QTimeZoneData *data() const;
+
+   static QString zonePath();
+   static QString zoneFile();
+
+private:
+   static QString sZonePath;
+   static QString sZoneFile;
+
+};
+
+class QTimeZoneData
+{
+public:
+    QTimeZoneData() : mId(0) { }
+    QTimeZoneData( const QString &id );
+
+    bool matchAbbrev( const QDateTime &t,
+        QString standardAbbrev,
+        QString daylightAbbrev ) const;
+
+    bool matchTime( const QDateTime &t,
+    long utcOffset, bool isdst ) const;
+
+    bool isValid() const;
+    bool isDaylightSavings( const QDateTime & ) const;
+
+    QDateTime toUtc( const QDateTime & ) const;
+    QDateTime fromUtc( const QDateTime & ) const;
+
+    QString id() const { return mId; }
+    QString standardAbbreviation() const;
+    QString dstAbbreviation() const;
+
+    QString tzSetFormat(int stdIndex, int dstStartIndex, int dstEndIndex) const;
+    QString tzSetFormat(const QDateTime &) const;
+
+    static QTimeZoneData *null;
+    qint32 utcOffSet(const QDateTime &) const;
+
+   void setTzDateTime(QDateTime dt);
+
+private:
+    /** find the transition time that should apply to \a t
+    */
+    int findTranstionTimeIndex( const QDateTime & t, bool utc ) const;
+    int findTimeTypeIndex( const QDateTime & t, bool utc ) const;
+
+    QString mId;
+    bool mDstRule;
+
+   QDateTime tzDateTime;
+    struct transitionInfo {
+        quint32 time;
+        int timeTypeIndex;
+    };
+
+    struct ttinfo {
+        qint32       utcOffset; // in secs
+        bool          isDst;
+        unsigned int  abbreviationIndex;
+        bool          isWallTime;
+        bool          isTransitionLocal;
+    };
+
+    QVector<transitionInfo> transitionTimes;
+    QVector<ttinfo> timeTypes;
+    QMap<uint, QString> abbreviations;
+    void getSystemTimeZoneData(const QString &line);
+};
+
+
+class QTimeZoneLocation
+{
+public:
+    QTimeZoneLocation( const char *line );
+
+    bool isValid() const { return !mId.isEmpty(); }
+
+    int latitude() const; // in seconds
+    int longitude() const;// in seconds
+
+    QString description() const;
+    QString area() const;
+    QString city() const;
+    QString countryCode() const;
+    QByteArray id() const;
+    int distance( const QTimeZoneLocation &e ) const
+        { return qAbs(latitude() - e.latitude()) + qAbs(longitude() - e.longitude()); }
+
+    static void load( QHash<QByteArray,QTimeZoneLocation*> &store );
+private:
+
+    void getSystemTimeZoneLocation(const char *line);
+    int calcLat(const QConstCString &) const;
+    int calcLon(const QConstCString &) const;
+
+    QByteArray mId;
+    QByteArray mDescription;
+    QByteArray mCountryCode;
+    int mLat;
+    int mLon;
+};
+
+class QTzCache
+{
+
+public:
+    static QTzCache &instance();
+    QTimeZoneData *data( const QString &id );
+    QTimeZoneLocation *location( const QString &id );
+    QStringList ids();
+    QTimeZoneData *findFromMinutesEast(QDateTime t, int mineast, bool isdst);
+
+
+private:
+    QTzCache();
+    QMap<QString,QTimeZoneData*> mDataDict;
+    QHash<QByteArray,QTimeZoneLocation*> mLocationDict;
+    static QTzCache *sInstance;
+};
+
+QT_END_NAMESPACE
+
+#endif
+#endif
diff --git a/src/corelib/tools/qtimezone_s60.cpp b/src/corelib/tools/qtimezone_s60.cpp
new file mode 100644
index 0000000..34c8940
--- /dev/null
+++ b/src/corelib/tools/qtimezone_s60.cpp
@@ -0,0 +1,422 @@
+/****************************************************************************
+ **
+ ** This file is part of the $PACKAGE_NAME$.
+ **
+ ** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+ **
+ ** $QT_EXTENDED_DUAL_LICENSE$
+ **
+ ****************************************************************************/
+#include <qtimezone.h>
+
+#include <QDataStream>
+#include <QDateTime>
+#include <QDebug>
+
+#include <QHash>
+#include <QRegExp>
+
+#include <QtGlobal>
+
+#include <QtCore/qdatetime.h>
+#include <QtCore/qobject.h>
+
+#include <stdlib.h>
+#include <time.h>
+
+
+/*******************************************************************
+ *
+ * QTimeZonePrivate
+ *
+ *******************************************************************/
+#ifndef QT_BOOTSTRAPPED
+
+QString QTimeZonePrivate::zonePath()
+{
+   if ( sZonePath.isNull() ) {
+      sZonePath = "";
+   }
+   return sZonePath;
+}
+
+QString QTimeZonePrivate::zoneFile()
+{
+   if ( sZoneFile.isNull() ) {
+      sZoneFile = "";
+   }
+   return sZoneFile;
+}
+
+/*******************************************************************
+ *
+ * QTimeZoneData
+ *
+ *******************************************************************/
+
+void QTimeZoneData::getSystemTimeZoneData(const QString & line)
+{//    qWarning() << "QTimeZoneData::QTimeZoneData" << loc;
+// FIXME
+   static RTz timeZoneServer;
+
+   timeZoneServer.Connect();
+
+   CTzLocalizedCityArray *cityZones = localizer->GetCitiesL(CTzLocalizer::ETzAlphaStandardNameAscending);
+   quint cityCount = cityZones->Count();
+//   const QList<quint> qTzNumericIds;
+   quint timezoneId;
+
+   for(qint i = 0; i < cityCount; i++) { //for each city
+
+      const RArray< TInt > aTzNumericIds;
+      RArray< TInt > aOffsets;
+      timezoneId = cityZones->At(i).TimeZoneId();
+      qWarning() << timezoneId;
+      aTzNumericIds.Append(timezoneId);
+
+      CTzLocalizedTimeZone* tz = localizer->GetLocalizedTimeZoneL(timeZoneId);
+      CTzId* tzoneId = CTzId::NewL(timezoneId);
+      CleanupStack::PushL(timezoneId);
+
+      //timeZoneServer.GetOffsetsForTimeZoneIdsL(aTzNumericIds, aOffsets );
+
+      CTzRules *tzRules = GetTimeZoneRulesL(const TTime &aStartTime, const TTime &aEndTime, TTzTimeReference aTimeRef);
+
+      qint startRulesYear = tzRules->StartYear();
+      qint endRulesYear = tzRules->EndYear();
+      qint tzRulesCount = tzRules->Count();
+// seconds to epoc from 0 ad -2208985200
+
+      for (int i = 0; i < tzRulesCount; i++) {
+// for each rule, get transition times
+         int year = startRulesYear + i;
+         TTzRule tzrule = tzRules->operator[](i);
+// this is ugly, but S60 time starts at 0 AD (whatever that is), so we have to convert to unix time.
+         TVTzActualisedRule *aRule = tzrule->ActualiseL(year);
+         TDateTime *tDate = aRule->aTimeOfChange->DateTime();
+
+         QDateTime qDate( QDate(tDate.Year(), tDate.Month(),tDate,Day()),
+                          QTime(tDate.Hour(), tDate.Minute(), tdate.Second()));
+
+
+         transInfo.time = qDate.toTime_t();
+         transInfo.timeTypeIndex = 0;
+         transitionTimes[i] = transInfo;
+         offsetInfo.utcOffset = aRule->iNewOffset;
+
+         CleanupStack::PopAndDestroy(timezoneId);
+         CleanupStack::PopAndDestroy(1);
+
+// iTimeOfChange
+      }
+
+
+//      aTzNumericIds.Append( cityZones->At(i).TimeZoneId());
+   }
+/////////
+
+//       CTzLocalizedTimeZoneArray* timeZones = localizer->GetAllTimeZonesL(CTzLocalizer::ETzAlphaStandardNameAscending);
+//       qint count = timeZones->Count();
+//       for( i = 0; i < count; i++) { //for each timezone
+
+//          TPtrC temp(timeZones->At(i).StandardName());
+//          if ((&temp)->Length()!=0) {
+//             QString string = QString::fromRawData(reinterpret_cast<const QChar *>(temp.Ptr()), temp.Length());
+//             qWarning() << "QTimeZoneData::getS60TzData" << string;
+// // DaylightName() ShortDaylightName(), ShortStandardName() StandardName()
+// //           console->Printf(timeZones->At(i).ShortStandardName());
+//          }
+//       }
+
+
+//    delete timeZones;
+
+      // find transition times for each
+
+
+      /*
+        numTransitionTimes
+
+        transitionTimes.resize(numTransitionTimes + 1);
+        for (int i = 0; i < numTransitionTimes + 1; i++) {
+
+        transInfo.time = secSinceEpoc;
+        transInfo.timeTypeIndex = 0;
+        transitionTimes[i] = transInfo;
+
+
+        offsetInfo.isDst = true;
+        offsetInfo.utcOffset = -(rti.Bias + rti.DaylightBias) * 60;
+
+        timeTypes[j + 1] = offsetInfo;
+
+        QSettings tzSetting3("HKEY_LOCAL_MACHINE\\" + rSubKey, QSettings::NativeFormat);
+
+        abbreviations.insert( i, tzSetting3.value("Std").toString() );
+
+      */
+
+      }
+
+
+/*******************************************************************
+ *
+ * QTimeZoneLocation
+ *
+ *******************************************************************/
+
+void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
+{
+//   qWarning() << "QTimeZoneLocation::QTimeZoneLocation" << line;
+
+   // S60
+   //use RWorldServer to FindCity() and get TLatLong
+   RWorldServer wServer;
+   wServer.Connect();
+   TWorldId cid;
+   TDesC &cName = line;
+   wServer.FindCity(cid, cName);
+   TCityData cData;
+   wServer.CityData(cData, cid);
+   TLatLong cLatLong = cData.iLatLong;
+   lat = cLatLong.MinutesLat();
+   long = cLatLong.MinutesLong();
+   wServer.Close();
+
+}
+
+QString QTimeZoneLocation::area() const
+{
+   QString displayArea = mId;
+   int sp = displayArea.lastIndexOf('/');
+   if (sp >= 0)
+      displayArea.truncate(sp);
+   displayArea.replace( '_', ' ' );
+   return displayArea.toAscii().constData();
+}
+
+QString QTimeZoneLocation::city() const
+{
+   QString displayCity;
+   int sp = mId.lastIndexOf('/');
+   if (sp >= 0)
+      displayCity = mId.mid(sp+1);
+   displayCity.replace( '_', ' ' );
+
+   return displayCity.toAscii().constData();
+}
+
+/*!
+  Loads and creates the tz database cache
+*/
+void QTimeZoneLocation::load( QHash<QByteArray,QTimeZoneLocation*> &store )
+{
+// FIXME
+}
+
+/*!
+  Construct an invalid time zone.
+*/
+QTimeZone::QTimeZone()
+{
+   d = new QTimeZonePrivate(QString());
+}
+
+
+/*!
+  Returns a time zone that, at time \a t, is \a mineast minutes ahead of GMT,
+  and is observing Daylight Time according to \a isdst.
+
+  Usually, the returned timezone will be a UNIX GMT time zone offset
+  (eg. "GMT-10" for 10 hours East of GMT), however, if no such timezone
+  exists (eg. for half-hour time zones), a city time zone will be returned.
+*/
+QTimeZone QTimeZone::findFromMinutesEast(const QDateTime& t, int mineast, bool isdst)
+{
+   if ( mineast % 60 == 0 ) {
+      QString s;
+      s.sprintf("Etc/GMT%+d",-mineast/60);
+      return QTimeZone(s);
+   }
+
+   // Fallback: find non-standard city
+   QTimeZoneData *data = QTzCache::instance().findFromMinutesEast(t,mineast,isdst);
+   return QTimeZone(data ? data->id() : QString());
+}
+
+/*!
+  Return the current system UTC date and time.
+*/
+//FIXME to QDateTime  QDateTime::fromTime_t
+
+// QDateTime QTimeZone::currentUtcDateTime()
+// {
+//     return QDateTime::fromTime_t/*QTimeZonePrivate::setUtcTime*/( /*(time_t)*/time(0) );
+// }
+
+
+
+
+
+////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////
+/*!
+  Returns the date and time \a dt in this time zone as
+  a date and time in UTC.
+*/
+
+QDateTime QTimeZone::toUtc( const QDateTime &dt ) const
+{
+   QTimeZoneData *data = d->data();
+   return data->toUtc( dt );
+}
+
+
+
+
+
+/*!
+  Returns the UTC date and time \a utc as a date and time in this time zone.
+*/
+
+QDateTime QTimeZone::fromUtc( const QDateTime &utc ) const
+{
+   QTimeZoneData *data = d->data(); //create QTzCache instance
+   return data->fromUtc( utc );
+}
+
+
+
+
+/*!
+  Returns the date and time \a dt in this time zone as the date and time
+  in the current system time zone.
+
+  \sa current()
+*/
+//FIXME redundant QDateTime::toLocal
+//QDateTime QTimeZone::toCurrent( const QDateTime &dt ) const
+//{
+//    QTimeZone curTz = current();
+//    return curTz.convert( dt, *this );
+//}
+
+/*!
+  Returns the date and time \a curT in the current time zone as the
+  date and time in this time zone.
+
+  \sa current()
+*/
+//QDateTime QTimeZone::fromCurrent( const QDateTime &curT ) const
+//{
+//    QTimeZone curTz = current();
+//    return convert( curT, curTz );
+//}
+
+
+
+
+/*!
+  Return the date and time \a dt in time zone \a dtTz as the date and time
+  in this time zone.
+*/
+
+QDateTime QTimeZone::convert( const QDateTime &dt, const QTimeZone &dtTz ) const
+{
+//   qWarning() << "QTimeZOne::convert";
+   d->data()->setTzDateTime(dt);
+   QDateTime utc = dtTz.toUtc( dt );
+   return fromUtc( utc );
+}
+
+
+
+
+//I would expect QDateTime to be modified to hold a QTimeZone internally, so
+//that the API would be:
+//QTimeZone timeZone() const
+//QDateTime QDateTime::toTimeZone(const QTimeZone &tz) const;
+
+// /*!
+//   Gets the UTC offset in number of hours for the date time /a c between this timezone and UTC.
+//   East of UTC would be negative (i.e. -9.5 UTC) and Westd
+
+qreal QTimeZone::getUTCOffset(const QDateTime &c) const
+{
+   QTimeZoneData *data = d->data();
+   return (float)data->utcOffSet(c)/60/60;
+}
+/*!
+  Returns true if the date time /a c in this timezone is under daylight saving rules, otherwise false;
+*/
+bool QTimeZone::isDst(const QDateTime &c) const
+{
+   QTimeZoneData *data = d->data();
+   bool dlt = data->isDaylightSavings(c);
+//   qWarning() <<dlt;
+   return dlt;
+}
+
+
+/*!
+  Returns the current system time zone.
+*/
+QTimeZone QTimeZone::current()
+{
+// FIXME get current tz name here
+   return QTimeZone();
+}
+
+
+/*!
+  Returns the translated greater area of this time zone, e.g. Europe.
+*/
+// FIXME could possibly use windows ->tzid mapping
+QString QTimeZone::area() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->area();
+   return QString();
+}
+
+/*!
+  Returns either the city() for this time zone, or some other
+  string meaningful to the user (eg. "GMT+10" meaning 10 hours
+  East of GMT).
+
+*/
+QString QTimeZone::name() const
+{
+   if (d->id().left(7) == "Etc/GMT") {
+      // UNIX uses hours West (i.e. towards Berkeley), i.e. "behind", not "ahead".
+      // Humans use hours "ahead" (i.e. "+") of GMT/UTC.
+      bool ok;
+      int west = d->id().mid(7).toInt(&ok);
+      if (ok) {
+         QString r;
+         r.sprintf("GMT %+d",-west);
+         return r;
+      }
+   }
+
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->city();
+
+}
+
+/*!
+  Returns the translated city of this time zone, e.g. Brisbane,
+  or a null string if no specific city is identified.
+*/
+// FIXME could possibly use windows ->tzid mapping
+QString QTimeZone::city() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->city();
+}
+//Q_IMPLEMENT_USER_METATYPE(QTimeZone)
+
+#endif //bootstrapped
diff --git a/src/corelib/tools/qtimezone_unix.cpp b/src/corelib/tools/qtimezone_unix.cpp
new file mode 100644
index 0000000..897d5fb
--- /dev/null
+++ b/src/corelib/tools/qtimezone_unix.cpp
@@ -0,0 +1,453 @@
+/****************************************************************************
+ **
+ ** This file is part of the $PACKAGE_NAME$.
+ **
+ ** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+ **
+ ** $QT_EXTENDED_DUAL_LICENSE$
+ **
+ ****************************************************************************/
+#include <qtimezone.h>
+
+
+#include <QDataStream>
+#include <QDateTime>
+#include <QDebug>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+#include <QMap>
+#include <QHash>
+#include <QVector>
+
+#include <QtGlobal>
+
+#include <QtCore/qdatetime.h>
+#include <QtCore/qobject.h>
+
+#include <stdlib.h>
+#include <time.h>
+#include "qtimezone_p.h"
+
+
+/*******************************************************************
+ *
+ * QTimeZonePrivate
+ *
+ *******************************************************************/
+#ifndef QT_BOOTSTRAPPED
+
+//////////////////////////////////
+QString QTimeZonePrivate::zonePath()
+{
+   if ( sZonePath.isNull() ) {
+      sZonePath = "/usr/share/zoneinfo/";
+   }
+   return sZonePath;
+}
+
+QString QTimeZonePrivate::zoneFile()
+{
+   if ( sZoneFile.isNull() ) {
+      sZoneFile = zonePath() + "zone.tab";
+   }
+   return sZoneFile;
+}
+
+void QTimeZoneData::getSystemTimeZoneData(const QString & line)
+{
+   qint32 numUtcIndicators, numStandardIndicators, numLeapSecs,
+      numTransitionTimes, numTimeTypes, tzAbbreviationChars;
+
+   QString fname = QTimeZonePrivate::zonePath() + mId;
+   fname = QDir::convertSeparators( fname );
+   QFile f( fname );
+   if ( !f.open( QIODevice::ReadOnly ) ) {
+      qWarning("Unable to open '%s'", (const char *)fname.toLatin1() );
+      return;
+   }
+// see tzfile.h in the zoneinfo database sources
+// and man tzfile 5
+
+   QByteArray data = f.readAll();
+   f.close();
+   if ( !data.size() ) {
+      qWarning("invalid data size = %d", data.size());
+      return;
+   }
+
+   QDataStream ds( data );
+
+   char rawMagic[5];
+   uint nbytes=4;
+   rawMagic[4] = 0;
+   ds.readRawData( rawMagic, nbytes );
+   QString magic( rawMagic );
+   if ( magic != "TZif"
+      ) {
+      // magic match failed
+      return;
+   }
+
+   char reserved[16];
+   nbytes = 16;
+   ds.readRawData(reserved, nbytes);
+   if ( nbytes != 16 ) {
+      qWarning("reserved size failed");
+      return;
+   }
+
+   ds >> numUtcIndicators >> numStandardIndicators >> numLeapSecs
+      >> numTransitionTimes >> numTimeTypes >> tzAbbreviationChars;
+
+//      qWarning() <<numUtcIndicators<< numStandardIndicators << numLeapSecs
+//                << numTransitionTimes << numTimeTypes << tzAbbreviationChars;
+
+////////////////
+   // add transition times
+////////////////
+   transitionTimes.resize(numTransitionTimes);
+   transitionInfo transInfo;
+   int i =0;
+   for ( i = 0; i < numTransitionTimes; ++i ) {
+       quint32 secs = 0;
+       ds >> secs; //tzh_timecnt offset in seconds
+
+//      qWarning() << "number of transition times" << secs;
+       if (secs < 2147483647) { //discard times past 2038, since these are invalid in unix time
+           transInfo.time = secs;
+       } else {
+           transInfo.time = 0;
+       }
+//           qWarning() << "transition time:" << i <<  QDateTime::fromTime_t(secs) << secs;
+           transInfo.timeTypeIndex = 0;
+           transitionTimes[i] = transInfo;
+   }
+
+   unsigned char byte = 0;
+   for ( i = 0; i < numTransitionTimes; ++i ) {
+      ds >> byte;
+      //  qWarning() << "types of local time" << byte;
+      transInfo = transitionTimes[i];
+      transInfo.timeTypeIndex = (int) byte;
+      transitionTimes[i] = transInfo;
+   }
+
+////////////////
+   // add abbreviation index
+////////////////
+   timeTypes.resize(numTimeTypes);
+   unsigned int maxAbbrevIndex = 0;
+   ttinfo offsetInfo;
+   for ( i =0; i < numTimeTypes; ++i ) { //tzh_typecnt
+      ds >> offsetInfo.utcOffset; //offset
+      ds >> byte; //isDst
+
+//      qWarning() << "offset" << offsetInfo.utcOffset << "isDst" << byte;
+
+      offsetInfo.isDst = (bool) byte;
+      if ( offsetInfo.isDst )
+         mDstRule = true;
+      ds >> byte; //abbr. list index
+      offsetInfo.abbreviationIndex = (unsigned int)byte;
+      timeTypes[i] = offsetInfo;
+
+      if (  offsetInfo.abbreviationIndex > maxAbbrevIndex )
+         maxAbbrevIndex = offsetInfo.abbreviationIndex;
+   }
+
+////////////////
+   // add abbreviations
+////////////////
+   //  qWarning() << "Abbrv index" << maxAbbrevIndex;
+   char abbrev[5];
+   abbrev[4] = 0;
+   nbytes = 4;
+   for ( uint index = 0; index <= maxAbbrevIndex; index += 4 ) { //thz_charcnt
+      ds.readRawData( abbrev, nbytes );
+      //   qWarning() << "abbrv" << abbrev;
+      abbreviations.insert( index, abbrev );
+   }
+
+   // leap seconds aren't set for any file, so not exactly sure
+   // what they are used for
+   for ( i = 0; i < numLeapSecs; ++i ) { //thz_leapcnt
+      qint32 leapSecOccurs, applyLeapSecs;
+      ds >> leapSecOccurs >> applyLeapSecs;
+   }
+
+   for ( i = 0; i < numStandardIndicators; ++i ) {//thz_ttisstdcnt
+      ds >> byte;
+      offsetInfo = timeTypes[i];
+      offsetInfo.isWallTime = !(bool) byte;
+      timeTypes[i] = offsetInfo;
+   }
+
+   for ( i = 0; i < numUtcIndicators; ++i ) { //thz_ttisgmtcnt
+      ds >> byte;
+      offsetInfo = timeTypes[i];
+      offsetInfo.isTransitionLocal = !(bool) byte;
+      timeTypes[i] = offsetInfo;
+   }
+}
+
+void QTimeZoneData::setTzDateTime(QDateTime dt)
+{
+   tzDateTime = dt;
+}
+
+
+/*******************************************************************
+ *
+ * QTimeZoneLocation
+ *
+ *******************************************************************/
+
+
+void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
+{
+//   qWarning() << "QTimeZoneLocation::QTimeZoneLocation" << line;
+
+   QConstCString mLine(line);
+
+   int pos = 0;
+   int endPos = mLine.length();
+
+   int tokenBegin = pos;
+   int tokenNum = 0;
+
+   const char *pLine = line + pos;
+   while (pos < endPos) {
+      char ch = *pLine;
+      if ( ch == '\t' || ch == '\n' || ch == '\r' || pos+1 == endPos ) {
+         QConstCString token = mLine.mid(tokenBegin, pos-tokenBegin);
+         switch ( tokenNum ) {
+         case 0:
+            mCountryCode = token.toByteArray();
+            break;
+         case 1: {
+            QConstCString latStr, lonStr;
+            if ( token.length() == 15 ) {
+               latStr = token.mid(0, 7);
+               lonStr = token.mid(7);
+            } else if ( token.length() == 11 ) {
+               latStr = token.mid(0, 5);
+               lonStr = token.mid(5);
+            }
+            else {
+               qWarning() << "can't parse lat lon str" << token.toByteArray();
+               return;
+            }
+
+            // sanity check
+            if ( latStr[0] != '+' && latStr[0] != '-') {
+               qWarning("lat/lon is invalid");
+               return;
+            }
+            mLat = calcLat(latStr);
+            mLon = calcLon(lonStr);
+         }
+            break;
+         case 2: {
+            mId = token.toByteArray();
+         } break;
+         case 3:
+            mDescription = token.toByteArray();
+            break;
+         }
+
+         tokenNum++;
+         tokenBegin = pos+1;
+      }
+
+      pos++;
+      pLine++;
+   }
+}
+
+
+QString QTimeZoneLocation::area() const
+{
+   QString displayArea = mId;
+   int sp = displayArea.lastIndexOf('/');
+   if (sp >= 0)
+      displayArea.truncate(sp);
+   displayArea.replace( '_', ' ' );
+   return displayArea.toAscii().constData();
+}
+
+QString QTimeZoneLocation::city() const
+{
+   QString displayCity;
+   int sp = mId.lastIndexOf('/');
+   if (sp >= 0)
+      displayCity = mId.mid(sp+1);
+   displayCity.replace( '_', ' ' );
+
+   return displayCity.toAscii().constData();
+}
+
+/*!
+  Loads and creates the tz database cache
+*/
+void QTimeZoneLocation::load( QHash<QByteArray,QTimeZoneLocation*> &store )
+{
+   QFile file( QTimeZonePrivate::zoneFile() );
+   if ( !file.open( QIODevice::ReadOnly ) ) {
+      qWarning( "Unable to open %s", (const char *)file.fileName().toLatin1() );
+      qFatal( "Fatal: Timezone data must be installed at %s, exiting",
+              (const char *)QTimeZonePrivate::zonePath().toLatin1() );
+      return;
+   }
+   QTimeZoneLocation *tz = NULL;
+   char line[2048];
+   while ( !file.atEnd() ) {
+
+      file.readLine( line, 2048 );
+      if ( line[0] == '#' )
+         continue;
+      tz = new QTimeZoneLocation( line);
+
+      if ( !tz->isValid() ) {
+         qWarning() << "QTimeZoneLocation::load Unable to parse line" << line;
+         delete tz; tz = NULL;
+         continue;
+      }
+      store.insert( tz->id(), tz );
+
+   }
+
+
+   file.close();
+//                // Disable the privilege
+//                tokenPrivileges.Privileges[0].Attributes = 0;
+//                AdjustTokenPrivileges(hToken,FALSE,&tokenPrivileges,0,(PTOKEN_PRIVILEGES)NULL,0);
+// //
+}
+
+
+/*!
+  Returns the current system time zone.
+*/
+QTimeZone QTimeZone::current()
+{
+
+   QString cZone;
+#ifndef __UCLIBC__
+   cZone = getenv("TZ");
+#endif // __UCLIBC__
+   if (cZone.isEmpty()) {
+      QFile file("/etc/timezone");
+      if (file.open(QFile::ReadOnly))
+         cZone = file.readAll().trimmed();
+   }
+
+
+   QTimeZone env(cZone);
+   if ( env.isValid() )
+      return env;
+
+//    time_t now = time(0);
+//    tm tM;
+//    localtime_r(&now,  &tM);
+//    cZone = tM.tm_zone;
+
+   QTimeZone lt(cZone);
+   if ( lt.isValid() )
+      return lt;
+
+   QFileInfo el("/etc/localtime");
+   QString zone = el.readLink();
+
+   int z = zone.indexOf("/zoneinfo/");
+   if ( z >= 0 ) {
+      QTimeZone zi(zone.mid(z+10));
+      if ( zi.isValid() )
+         return zi;
+   }
+
+   qWarning() << "doesnt get here often";
+   QString currentLoc;
+   // this is mainly for windows side code, in the initial case
+   tzset();
+
+   QString standardAbbrev, daylightAbbrev;
+
+   standardAbbrev = tzname[0];
+   daylightAbbrev = tzname[1];
+
+   QDateTime today = QDateTime::currentDateTime();
+
+   QStringList allIds = QTzCache::instance().ids();
+
+   foreach (QString id, allIds) {
+      if (id.isEmpty())
+         continue;
+
+      QTimeZoneData *data = QTzCache::instance().data( id );
+
+      if ( data->matchAbbrev( today, standardAbbrev, daylightAbbrev ) ) {
+         currentLoc = id;
+         break;
+      }
+   }
+   if ( !currentLoc.isEmpty() ) {
+      return QTimeZone (currentLoc);
+   }
+
+//    qWarning() << "returning undefined QTimeZone";
+   return QTimeZone();
+}
+
+/*!
+  Returns the translated greater area of this time zone, e.g. Europe.
+*/
+// FIXME could possibly use windows ->tzid mapping
+QString QTimeZone::area() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->area();
+   return QString();
+}
+
+/*!
+  Returns either the city() for this time zone, or some other
+  string meaningful to the user (eg. "GMT+10" meaning 10 hours
+  East of GMT).
+
+*/
+QString QTimeZone::name() const
+{
+   if (d->id().left(7) == "Etc/GMT") {
+      // UNIX uses hours West (i.e. towards Berkeley), i.e. "behind", not "ahead".
+      // Humans use hours "ahead" (i.e. "+") of GMT/UTC.
+      bool ok;
+      int west = d->id().mid(7).toInt(&ok);
+      if (ok) {
+         QString r;
+         r.sprintf("GMT %+d",-west);
+         return r;
+      }
+   }
+
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->city();
+
+}
+
+/*!
+  Returns the translated city of this time zone, e.g. Brisbane,
+  or a null string if no specific city is identified.
+*/
+// FIXME could possibly use windows ->tzid mapping
+QString QTimeZone::city() const
+{
+   QTimeZoneLocation *loc = d->location();
+   if ( loc )
+      return loc->city();
+}
+//Q_IMPLEMENT_USER_METATYPE(QTimeZone)
+
+#endif //bootstrapped
diff --git a/src/corelib/tools/qtimezone_win.cpp b/src/corelib/tools/qtimezone_win.cpp
new file mode 100644
index 0000000..e52ed40
--- /dev/null
+++ b/src/corelib/tools/qtimezone_win.cpp
@@ -0,0 +1,530 @@
+/****************************************************************************
+ **
+ ** This file is part of the $PACKAGE_NAME$.
+ **
+ ** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+ **
+ ** $QT_EXTENDED_DUAL_LICENSE$
+ **
+ ****************************************************************************/
+#include <qtimezone.h>
+
+#include <QDateTime>
+#include <QDebug>
+#include <QHash>
+#include <QSettings>
+
+#include <QtGlobal>
+
+#include <QtCore/qdatetime.h>
+#include <QtCore/qobject.h>
+#include "qtimezone_p.h"
+
+#include <stdlib.h>
+#include <time.h>
+
+#ifdef Q_OS_WIN
+#include <windows.h>
+typedef struct T_REG_TZI
+{
+   long Bias;
+   long StandardBias;
+   long DaylightBias;
+   SYSTEMTIME StandardDate;
+   SYSTEMTIME DaylightDate;
+} REG_TZI;
+static const REGSAM registryPermissions = KEY_READ | KEY_WRITE;
+
+#define SECS_1601_TO_1970  ((369 * 365 + 89) * 86400);
+
+/*
+  typedef struct _TIME_ZONE_INFORMATION {
+  LONG       Bias;
+  WCHAR      StandardName[32];
+  SYSTEMTIME StandardDate;
+  LONG       StandardBias;
+  WCHAR      DaylightName[32];
+  SYSTEMTIME DaylightDate;
+  LONG       DaylightBias;
+  } TIME_ZONE_INFORMATION,
+  *PTIME_ZONE_INFORMATION;
+
+  typedef struct _SYSTEMTIME {
+  WORD wYear;
+  WORD wMonth;
+  WORD wDayOfWeek;
+  WORD wDay;
+  WORD wHour;
+  WORD wMinute;
+  WORD wSecond;
+  WORD wMilliseconds;
+  } SYSTEMTIME,
+  *PSYSTEMTIME;
+
+*/
+#endif // Q_OS_WIN
+
+/*******************************************************************
+ *
+ * QTimeZonePrivate
+ *
+ *******************************************************************/
+#ifndef QT_BOOTSTRAPPED
+QString QTimeZonePrivate::zonePath()
+{
+   if ( sZonePath.isNull() ) {
+      sZonePath = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones";
+   }
+   return sZonePath;
+}
+
+QString QTimeZonePrivate::zoneFile()
+{
+   if ( sZoneFile.isNull() ) {
+      sZoneFile = "";
+   }
+   return sZoneFile;
+}
+
+/*******************************************************************
+ *
+ * QTimeZoneData
+ *
+ *******************************************************************/
+
+
+void QTimeZoneData::getSystemTimeZoneData(const QString & line)
+{
+   //   qWarning() << "QTimeZoneData::getRegistryTimeZoneData" << line;
+   if (!tzDateTime.isValid()) {
+//      qWarning() << "THis tzDateTime is not valid, use current datetime";
+      tzDateTime = QDateTime::currentDateTime();
+   }
+
+   REG_TZI rti;
+
+   qint32 numTransitionTimes;
+
+   HKEY hKeyResult = 0;
+// get all tz's
+   QString rSubKey ;
+   QString tzReg = QTimeZonePrivate::zonePath();
+
+   QSettings tzSetting0("HKEY_LOCAL_MACHINE\\" + tzReg, QSettings::NativeFormat);
+   QStringList tzList = tzSetting0.childGroups();
+
+   for (int i = 0; i < tzList.count(); ++i) {
+
+      QSettings tzSetting1("HKEY_LOCAL_MACHINE\\" + tzReg + "\\"+tzList.at(i),
+                           QSettings::NativeFormat);
+
+      QString id = tzSetting1.value("Display").toString();
+
+      if (id == line) {
+         rSubKey = tzReg + "\\" + tzList.at(i);
+         //found it, now move on
+         break;
+      }
+   }
+
+   QSettings tzSetting("HKEY_LOCAL_MACHINE\\" + rSubKey, QSettings::NativeFormat);
+   transitionInfo transInfo;
+   ttinfo offsetInfo;
+
+   SYSTEMTIME stdDate;
+   SYSTEMTIME dltDate;
+   LONG res;
+   bool hasHistory = false;
+
+   QString subsubkey;
+
+   int firstYear;
+   int lastYear;
+
+   if (tzSetting.childGroups().count() > 0) {
+
+      QSettings tzSetting2("HKEY_LOCAL_MACHINE\\" + rSubKey+"\\"+"Dynamic DST\\",
+                           QSettings::NativeFormat);
+      firstYear = tzSetting2.value("FirstEntry").toInt();
+      lastYear = tzSetting2.value("LastEntry").toInt();
+
+//two transitions per year.
+      numTransitionTimes = ((lastYear - firstYear) + 1) * 2; //this assumes all years are in the same century
+      hasHistory = true;
+
+   } else {
+      numTransitionTimes = 1;
+      hasHistory = false;
+   }
+
+//   qWarning() << "number of transition times" << numTransitionTimes;
+
+   transitionTimes.resize( numTransitionTimes * 2);
+   timeTypes.resize(numTransitionTimes * 2);
+
+
+   for (int i = 0; i < numTransitionTimes ; i++) {
+
+      int j;
+      j =  i * 2;
+
+      QString st;
+
+      if (hasHistory) {
+         subsubkey = rSubKey + "\\Dynamic DST";
+         st = QString::number(firstYear+i);
+      } else {
+         subsubkey = rSubKey;
+         st = "TZI";
+      }
+
+      QT_WA( {
+            res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+                                reinterpret_cast<const wchar_t *>(subsubkey.utf16()),
+                                0, registryPermissions, &hKeyResult);
+         } , {
+                res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subsubkey.toLocal8Bit(),
+                                    0, registryPermissions, &hKeyResult);
+             } );
+      //get Zoneinfo
+
+      DWORD dwSize;
+      LONG lRetVal;
+      dwSize = sizeof(rti);
+      if (res == ERROR_SUCCESS) {
+         QT_WA( {
+               lRetVal = RegQueryValueEx(hKeyResult,
+                                         reinterpret_cast<const wchar_t *>(st.utf16()),
+                                         0, 0, (BYTE*)&rti, &dwSize);
+            } , {
+                   lRetVal = RegQueryValueExA(hKeyResult, st.toLocal8Bit(), 0, 0, (BYTE*)&rti, &dwSize);
+                } );
+
+///////// std
+
+            stdDate = rti.StandardDate;
+            dltDate = rti.DaylightDate;
+
+            int s = j;
+            int d = j;
+            if (dltDate.wMonth !=0) // 0 is there is no dlt
+               if (stdDate.wMonth < dltDate.wMonth) { // make sure to insert in chrono order
+                  s = j;
+                  d = j + 1;
+               }  else {
+                  s = j + 1;
+                  d = j;
+               }
+
+
+//         qWarning() << "STD day month year" << stdDate.wDay << stdDate.wMonth << stdDate.wYear;
+
+            if ( stdDate.wDay << stdDate.wMonth << stdDate.wYear ) {
+               stdDate.wYear = firstYear + i;
+            }
+
+            quint32 secSinceEpoc = QDateTime(QDate(stdDate.wYear, stdDate.wMonth, stdDate.wDay),
+                                             QTime(stdDate.wHour, stdDate.wHour, stdDate.wSecond)).toTime_t();
+
+//         qWarning() <<"Standard time: secSinceEpoc "<<  secSinceEpoc <<
+//            QDateTime::fromTime_t(secSinceEpoc);
+
+//         qWarning() << "day month year" << stdDate.wDay << stdDate.wMonth << stdDate.wYear << i;
+
+            transInfo.time = secSinceEpoc;
+            transInfo.timeTypeIndex = s;
+            transitionTimes[s] = transInfo;
+
+//         qWarning() << "transitionTimes" << i;
+
+            offsetInfo.isDst = false;
+            offsetInfo.utcOffset = -(rti.Bias * 60); //in seconds
+//         qWarning() << "standbias" <<  -(rti.Bias * 60);
+//         offsetInfo.abbreviationIndex = (unsigned int)byte;
+            timeTypes[s] = offsetInfo;
+
+            QSettings tzSetting3("HKEY_LOCAL_MACHINE\\" + rSubKey, QSettings::NativeFormat);
+
+            abbreviations.insert( i, tzSetting3.value("Std").toString() );
+
+////////////////////////////////////////////////////////////////////////////////////////////// dlt
+
+            if (stdDate.wDay != 0
+                && stdDate.wMonth != 0) { //there is on daylight saving periods
+
+               if (dltDate.wYear == 0) {
+                  dltDate.wYear = firstYear + i;
+               }
+
+               secSinceEpoc = QDateTime(QDate(dltDate.wYear, dltDate.wMonth, dltDate.wDay),
+                                        QTime(dltDate.wHour, dltDate.wHour, dltDate.wSecond)).toTime_t();
+
+
+               transInfo.time = secSinceEpoc;
+//             qWarning() <<"Daylight time: secSinceEpoc "<<  secSinceEpoc << i <<
+//                QDateTime::fromTime_t(secSinceEpoc);
+
+               transInfo.timeTypeIndex = d;
+               transitionTimes[d] = transInfo;
+               offsetInfo.isDst = true;
+               offsetInfo.utcOffset = -(rti.Bias + rti.DaylightBias) * 60;
+
+//            qWarning() << "daylight bias"<< -(rti.Bias + rti.DaylightBias) * 60;
+
+               //offsetInfo.abbreviationIndex = (unsigned int)byte;
+//         transitionTimes.resize(i + 1); //two transitions per year.
+               timeTypes[d] = offsetInfo;
+//        transInfo.timeTypeIndex = 0;
+
+//         abbreviations.insert( i + 1, tzSetting3.value("Dlt").toString() );
+            } else {
+               transInfo.timeTypeIndex = 0;
+               transitionTimes[j + 1] = transInfo;
+               offsetInfo.isDst = false;
+               offsetInfo.utcOffset = 9999;
+               timeTypes[j + 1] = offsetInfo;
+            }
+
+//FIXME
+
+      } // end ERROR_SUCCESS
+   } //end numTransitionTimes
+}
+
+void QTimeZoneData::setTzDateTime(QDateTime dt)
+{
+   tzDateTime = dt;
+   getSystemTimeZoneData(mId);
+}
+
+/*******************************************************************
+ *
+ * QTimeZoneLocation
+ *
+ *******************************************************************/
+
+void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
+{//   qWarning() << "QTimeZoneLocation::QTimeZoneLocation" << line;
+//    mCountryCode = //index
+   //      mId =   // display
+   REG_TZI rti;
+
+   HKEY hKeyResult = 0;
+   QString rSubKey = "HKEY_LOCAL_MACHINE\\"+QTimeZonePrivate::zonePath()+"\\"+line;
+
+   QSettings tzSetting(rSubKey, QSettings::NativeFormat);
+
+//     mId = line;
+//     mDescription = tzSetting.value("Display").toString();
+
+   mId = tzSetting.value("Display").toString();
+   mDescription = line;
+
+//tzSetting.value( "Display").toString(); //description
+   mCountryCode = tzSetting.value( "Index").toByteArray();
+
+//    qWarning() << "mId" << mId << "mCountryCode" << mCountryCode;
+
+   LONG res;
+
+   // qDebug(rSubKey.toLocal8Bit());
+//get timezine infos
+
+   QT_WA( {
+         res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+                             reinterpret_cast<const wchar_t *>(rSubKey.utf16()),
+                             0, registryPermissions, &hKeyResult);
+      } , {
+             res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, rSubKey.toLocal8Bit(),
+                                 0, registryPermissions, &hKeyResult);
+          } );
+
+   //get Zoneinfo
+   QString st = "TZI";
+   DWORD dwSize;
+   LONG lRetVal;
+   dwSize = sizeof(rti);
+   if (res == ERROR_SUCCESS) {
+
+      QT_WA( {
+            lRetVal = RegQueryValueEx(hKeyResult,
+                                      reinterpret_cast<const wchar_t *>(st.utf16()), 0, 0, (BYTE*)&rti, &dwSize);
+         } , {
+                lRetVal = RegQueryValueExA(hKeyResult, st.toLocal8Bit(), 0, 0, (BYTE*)&rti, &dwSize);
+             } );
+      SYSTEMTIME sysTimeInfo;
+      //   long llout = rti.StandardBias;
+      sysTimeInfo = rti.StandardDate;
+      QString out;
+      out.setNum(sysTimeInfo.wMonth);
+//       qWarning() << out.toLocal8Bit();
+
+      // get Standard and Daylight names
+//       wchar_t tempS[32];
+//       st = "Std";
+      //      dwSize = sizeof(tempS);
+   }
+}
+
+QString QTimeZoneLocation::area() const
+{
+   return QString();
+}
+
+QString QTimeZoneLocation::city() const
+{
+   return QString();
+}
+
+/*!
+  Loads and creates the tz database cache
+*/
+void QTimeZoneLocation::load( QHash<QByteArray,QTimeZoneLocation*> &store )
+{
+   QTimeZoneLocation *tz = NULL;
+// windows reg here
+
+   // Enable the required privilege
+//        HANDLE hToken;
+//        TOKEN_PRIVILEGES tokenPrivileges;
+// //
+//        OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hToken);
+//        LookupPrivilegeValue(NULL,SE_TIME_ZONE_NAME,&tokenPrivileges.Privileges[0].Luid);
+//        tokenPrivileges.PrivilegeCount = 1;
+//        tokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+//        AdjustTokenPrivileges(hToken,FALSE,&tokenPrivileges,0,(PTOKEN_PRIVILEGES)NULL,0);
+// //
+
+
+   QString line;
+   QString tzReg = QTimeZonePrivate::zonePath();
+//        qWarning() <<" QTimeZoneLocation::load" << tzReg;
+
+   QSettings tzSetting("HKEY_LOCAL_MACHINE\\"+tzReg, QSettings::NativeFormat);
+   QStringList tzList = tzSetting.childGroups();
+
+   for (int i = 0; i < tzList.count(); ++i) {
+      line = tzList.at(i);
+
+//           qWarning() <<"QTimeZoneLocation::load"<< "line" << line;
+      QString reg = tzReg+"\\"+line;
+
+      QSettings tzZone("HKEY_LOCAL_MACHINE\\"+reg,  QSettings::NativeFormat);
+
+      if (tzZone.childKeys().count() > 1) { //rule out useless keys here
+         tz = new QTimeZoneLocation( line.toLocal8Bit() );
+
+         if ( !tz->isValid() ) {
+            qWarning() << "QTimeZoneLocation::load Unable to parse line" << line;
+            delete tz; tz = NULL;
+            continue;
+         }
+         store.insert( tz->id(), tz );
+
+      }
+
+   }
+//                // Disable the privilege
+//                tokenPrivileges.Privileges[0].Attributes = 0;
+//                AdjustTokenPrivileges(hToken,FALSE,&tokenPrivileges,0,(PTOKEN_PRIVILEGES)NULL,0);
+// //
+}
+
+/*******************************************************************
+ *
+ * QTimeZone
+ *
+ *******************************************************************/
+
+/*!
+  Returns the current system time zone.
+*/
+QTimeZone QTimeZone::current()
+{
+//    qWarning() << "QTimeZone::current()";
+
+
+   QString currentLoc;
+   // this is mainly for windows side code, in the initial case
+   _tzset();
+
+   QString standardAbbrev, daylightAbbrev;
+
+   standardAbbrev = _tzname[0];
+   daylightAbbrev = _tzname[1];
+
+   TIME_ZONE_INFORMATION rti;
+
+   int result =  GetTimeZoneInformation(&rti);
+   QString tz = QString::fromWCharArray(rti.StandardName);
+
+
+   QString rSubKey = QTimeZonePrivate::zonePath() + "\\" +tz;
+   QSettings tzSetting("HKEY_LOCAL_MACHINE\\" + rSubKey, QSettings::NativeFormat);
+
+   if (result == 0 || result == 1) {
+      currentLoc = tzSetting.value("Display").toString();
+   } else {
+
+      currentLoc = tzSetting.value("Display").toString();
+   }
+
+//    quint32 offset = rti.Bias;
+
+
+
+   QString curSubKey = "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation\\" + standardAbbrev;
+   QSettings tzSetting2("HKEY_LOCAL_MACHINE\\" + curSubKey, QSettings::NativeFormat);
+//    quint32 activeBias = tzSetting2.value("ActiveTimeBias").toUInt();
+
+//     qWarning() << "QTimeZoneCurrent()" << standardAbbrev << daylightAbbrev << currentLoc;
+//     qWarning() << "ActiveTimeBias" << activeBias << "Bias" << offset;
+//   currentLoc = standardAbbrev;
+
+
+   if ( !currentLoc.isEmpty() ) {
+//        qWarning() << currentLoc;
+      return QTimeZone (currentLoc);
+   }
+
+//    qWarning() << "returning undefined QTimeZone";
+   return QTimeZone();
+}
+
+
+/*!
+  Returns the translated greater area of this time zone, e.g. Europe.
+*/
+// FIXME could possibly use windows ->tzid mapping
+QString QTimeZone::area() const
+{
+   QString display = d->id();
+   return display.section(") ", 1, 1);
+}
+
+/*!
+  Returns either the city() for this time zone, or some other
+  string meaningful to the user (eg. "GMT+10" meaning 10 hours
+  East of GMT).
+
+*/
+QString QTimeZone::name() const
+{
+   QString display = d->id();
+   display = display.section(") ", 0, 0);
+   return display.right(display.length() - 1);
+
+}
+
+/*!
+  Returns the translated city of this time zone, e.g. Brisbane,
+  or a null string if no specific city is identified.
+*/
+// FIXME could possibly use windows ->tzid mapping
+QString QTimeZone::city() const
+{
+   return QString();
+}
+//Q_IMPLEMENT_USER_METATYPE(QTimeZone)
+
+#endif //bootstrapped
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index e5bf7e4..523097b 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -34,6 +34,8 @@ HEADERS +=  \
 	tools/qstringmatcher.h \
 	tools/qtextboundaryfinder.h \
 	tools/qtimeline.h \
+    tools/qtimezone.h \
+    tools/qtimezone_p.h \
 	tools/qunicodetables_p.h \
 	tools/qvarlengtharray.h \
 	tools/qvector.h
@@ -62,6 +64,7 @@ SOURCES += \
 	tools/qstringlist.cpp \
 	tools/qtextboundaryfinder.cpp \
 	tools/qtimeline.cpp \
+    tools/qtimezone.cpp \
 	tools/qvector.cpp \
         tools/qvsnprintf.cpp
 
@@ -102,3 +105,20 @@ SOURCES += ../3rdparty/harfbuzz/src/harfbuzz-buffer.c \
 HEADERS += tools/qharfbuzz_p.h
 
 !macx-icc:unix:LIBS += -lm
+
+
+win32 {
+SOURCES += tools/qtimezone_win.cpp
+}
+
+symbian {
+SOURCES += tools/qtimezone_s60.cpp 
+}
+
+unix {
+SOURCES += tools/qtimezone_unix.cpp 
+}
+
+mac {
+# SOURCES += tools/qtimezone_mac.cpp 
+}
commit 278d37aa4c9345b08af0e90992f6d854e5c2d17b
Author: Lorn Potter <lorn.potter@nokia.com>
Date:   Tue Mar 24 11:17:36 2009 +1000

    remove qconstcstring stuff. might add in later if needed. do not want to add a new string thing with qtimezone

diff --git a/src/corelib/tools/qconstcstring.h b/src/corelib/tools/qconstcstring.h
deleted file mode 100644
index 6531778..0000000
--- a/src/corelib/tools/qconstcstring.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** This file is part of the $PACKAGE_NAME$.
-**
-** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
-**
-** $QT_EXTENDED_DUAL_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCONSTCSTRING_H
-#define QCONSTCSTRING_H
-
-class QConstCString
-{
-public:
-    QConstCString()
-    : m_str(0), m_length(0)
-    {
-    }
-
-    QConstCString(const QConstCString &other)
-    : m_str(other.m_str), m_length(other.m_length)
-    {
-    }
-
-    QConstCString(const char *str)
-    : m_str(str), m_length(::strlen(str))
-    {
-    }
-
-    QConstCString(const char *str, int len)
-    : m_str(str), m_length(len)
-    {
-    }
-
-    char operator[](int pos) const
-    {
-        Q_ASSERT(pos < m_length);
-        return m_str[pos];
-    }
-
-    bool operator==(const QConstCString &other) const
-    {
-        return other.m_length == m_length &&
-               (0 == m_length ||
-                0 == ::memcmp(other.m_str, m_str, m_length));
-    }
-
-    bool operator<(const QConstCString &other) const
-    {
-        if(other.m_length != m_length)
-            return m_length < other.m_length;
-
-        return ::memcmp(m_str, other.m_str, m_length) < 0;
-    }
-
-    QConstCString &operator=(const QConstCString &other)
-    {
-        m_str = other.m_str;
-        m_length = other.m_length;
-        return *this;
-    }
-
-    QByteArray toByteArray() const
-    {
-        return QByteArray(m_str, m_length);
-    }
-
-    int length() const
-    {
-        return m_length;
-    }
-    const char * data() const
-    {
-        return m_str;
-    }
-
-    QConstCString left(int len) const
-    {
-        return QConstCString(m_str, qMin(len, m_length));
-    }
-
-    QConstCString mid(int pos, int len=-1) const
-    {
-        if(pos >= m_length)
-            return QConstCString(0, 0);
-
-        return QConstCString(m_str + pos,
-                             (len == -1)?
-                             (m_length - pos):qMin(len, m_length - pos));
-    }
-
-private:
-    const char * m_str;
-    int m_length;
-};
-
-#endif
commit dd50f57935a257c318850dde3afc038b0e3aded9
Author: Lorn Potter <lorn.potter@nokia.com>
Date:   Tue Mar 24 12:52:23 2009 +1000

    really remove qconststring

diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 2d5b1c3..bab8db1 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -20,7 +20,6 @@
 #include <QtCore/qdatetime.h>
 #include <QtCore/qobject.h>
 
-#include "qconstcstring.h" // ??
 #include "qtimezone_p.h"
 
 #include <stdlib.h>
@@ -332,25 +331,24 @@ QTimeZoneLocation::QTimeZoneLocation( const char *line )
 }
 
 
-int QTimeZoneLocation::calcLat(const QConstCString &latStr) const
+int QTimeZoneLocation::calcLat(const QString &latStr) const
 {
    int deg, min, sec;
    int sign = 1;
    if ( latStr[0] == '-' )
       sign = -1;
-   deg = (latStr[1] - '0') * 10 + (latStr[2] - '0');
-   min = (latStr[3] - '0') * 10 + (latStr[4] - '0');
 
-   //deg = latStr.mid(1, 2).toInt();
-   //min = latStr.mid(3, 2).toInt();
+   deg = latStr.mid(1, 2).toInt();
+   min = latStr.mid(3, 2).toInt();
+
    sec = 0;
    if ( latStr.length() == 7 )
-      sec = (latStr[5] - '0') * 10 + (latStr[6] - '0');
-//      sec = latStr.mid(5, 2).toInt();
+       sec = latStr.mid(5, 2).toInt();
+
    return sign*deg*3600 + sign*min*60 + sign*sec;
 }
 
-int QTimeZoneLocation::calcLon(const QConstCString &lonStr) const
+int QTimeZoneLocation::calcLon(const QString &lonStr) const
 {
    int deg, min, sec;
 
@@ -358,14 +356,11 @@ int QTimeZoneLocation::calcLon(const QConstCString &lonStr) const
    if ( lonStr[0] == '-' )
       sign = -1;
 
-   deg = (lonStr[1] - '0') * 100 + (lonStr[2] - '0') * 10 + (lonStr[3] - '0');
-   min = (lonStr[4] - '0') * 10 + (lonStr[5] - '0');
-   // deg = lonStr.mid(1, 3).toInt();
-   //min = lonStr.mid( 4, 2 ).toInt();
+   deg = lonStr.mid(1, 3).toInt();
+   min = lonStr.mid( 4, 2 ).toInt();
+
    sec = 0;
-   if ( lonStr.length() == 8 )
-      sec = (lonStr[6] - '0') * 10 + (lonStr[7] - '0');
-//      sec = lonStr.mid( 6, 2 ).toInt();
+   sec = lonStr.mid( 6, 2 ).toInt();
 
    return sign*deg*3600 + sign*min*60 + sign*sec;
 }
@@ -382,7 +377,7 @@ int QTimeZoneLocation::longitude() const
 
 QString QTimeZoneLocation::description() const
 {
-   return  mDescription.constData();
+   return  mDescription;
 }
 
 QString QTimeZoneLocation::countryCode() const
@@ -390,7 +385,7 @@ QString QTimeZoneLocation::countryCode() const
    return mCountryCode;
 }
 
-QByteArray QTimeZoneLocation::id() const
+QString QTimeZoneLocation::id() const
 {
    return mId;
 }
@@ -465,16 +460,13 @@ QTimeZoneLocation *QTzCache::location( const QString &id )
 //   qWarning() << "QTzCache::location" << id;
    if ( id.isEmpty() )
       return 0;
-   QTimeZoneLocation * l = mLocationDict[ id.toAscii() ];
+   QTimeZoneLocation * l = mLocationDict[ id ];
    return l;
 }
 
 QStringList QTzCache::ids()
 {
-   QStringList rv;
-   foreach(QByteArray key, mLocationDict.keys())
-      rv << key;
-   return rv;
+    return mLocationDict.keys();
 }
 
 QTimeZoneLocation *QTimeZonePrivate::location() const
diff --git a/src/corelib/tools/qtimezone_p.h b/src/corelib/tools/qtimezone_p.h
index e2e7493..99e117c 100644
--- a/src/corelib/tools/qtimezone_p.h
+++ b/src/corelib/tools/qtimezone_p.h
@@ -22,9 +22,7 @@
 // We mean it.
 //
 
-//#include "private/qobject_p.h"
 #include "QtCore/qtimezone.h"
-#include "qconstcstring.h" // ??
 
 #ifndef QT_BOOTSTRAPPED
 
@@ -133,20 +131,20 @@ public:
     QString area() const;
     QString city() const;
     QString countryCode() const;
-    QByteArray id() const;
+    QString id() const;
     int distance( const QTimeZoneLocation &e ) const
         { return qAbs(latitude() - e.latitude()) + qAbs(longitude() - e.longitude()); }
 
-    static void load( QHash<QByteArray,QTimeZoneLocation*> &store );
+    static void load( QHash<QString,QTimeZoneLocation*> &store );
 private:
 
     void getSystemTimeZoneLocation(const char *line);
-    int calcLat(const QConstCString &) const;
-    int calcLon(const QConstCString &) const;
+    int calcLat(const QString &) const;
+    int calcLon(const QString &) const;
 
-    QByteArray mId;
-    QByteArray mDescription;
-    QByteArray mCountryCode;
+    QString mId;
+    QString mDescription;
+    QString mCountryCode;
     int mLat;
     int mLon;
 };
@@ -165,7 +163,7 @@ public:
 private:
     QTzCache();
     QMap<QString,QTimeZoneData*> mDataDict;
-    QHash<QByteArray,QTimeZoneLocation*> mLocationDict;
+    QHash<QString,QTimeZoneLocation*> mLocationDict;
     static QTzCache *sInstance;
 };
 
diff --git a/src/corelib/tools/qtimezone_unix.cpp b/src/corelib/tools/qtimezone_unix.cpp
index 897d5fb..4c659bb 100644
--- a/src/corelib/tools/qtimezone_unix.cpp
+++ b/src/corelib/tools/qtimezone_unix.cpp
@@ -208,7 +208,7 @@ void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
 {
 //   qWarning() << "QTimeZoneLocation::QTimeZoneLocation" << line;
 
-   QConstCString mLine(line);
+   QString mLine(line);
 
    int pos = 0;
    int endPos = mLine.length();
@@ -226,7 +226,7 @@ void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
             mCountryCode = token.toByteArray();
             break;
          case 1: {
-            QConstCString latStr, lonStr;
+            QString latStr, lonStr;
             if ( token.length() == 15 ) {
                latStr = token.mid(0, 7);
                lonStr = token.mid(7);
@@ -290,7 +290,7 @@ QString QTimeZoneLocation::city() const
 /*!
   Loads and creates the tz database cache
 */
-void QTimeZoneLocation::load( QHash<QByteArray,QTimeZoneLocation*> &store )
+void QTimeZoneLocation::load( QHash<QString,QTimeZoneLocation*> &store )
 {
    QFile file( QTimeZonePrivate::zoneFile() );
    if ( !file.open( QIODevice::ReadOnly ) ) {
commit dacce909893eff50ae4fffee2ff1d1f3ed67e4a2
Author: lpotter <lorn.potter@nokia.com>
Date:   Tue Mar 24 13:11:13 2009 +1000

    bytearray -> string

diff --git a/src/corelib/tools/qtimezone_win.cpp b/src/corelib/tools/qtimezone_win.cpp
old mode 100644
new mode 100755
index e52ed40..32607a6
--- a/src/corelib/tools/qtimezone_win.cpp
+++ b/src/corelib/tools/qtimezone_win.cpp
@@ -379,7 +379,7 @@ QString QTimeZoneLocation::city() const
 /*!
   Loads and creates the tz database cache
 */
-void QTimeZoneLocation::load( QHash<QByteArray,QTimeZoneLocation*> &store )
+void QTimeZoneLocation::load( QHash<QString,QTimeZoneLocation*> &store )
 {
    QTimeZoneLocation *tz = NULL;
 // windows reg here
commit 630c529894ca8296cc09d0489c74a72e4d7d9a4d
Author: Lorn Potter <lorn.potter@nokia.com>
Date:   Mon Mar 30 12:50:39 2009 +1000

    remove qconstcstring stuff

diff --git a/src/corelib/tools/qtimezone_unix.cpp b/src/corelib/tools/qtimezone_unix.cpp
index 4c659bb..57ce69a 100644
--- a/src/corelib/tools/qtimezone_unix.cpp
+++ b/src/corelib/tools/qtimezone_unix.cpp
@@ -220,10 +220,10 @@ void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
    while (pos < endPos) {
       char ch = *pLine;
       if ( ch == '\t' || ch == '\n' || ch == '\r' || pos+1 == endPos ) {
-         QConstCString token = mLine.mid(tokenBegin, pos-tokenBegin);
+         QString token = mLine.mid(tokenBegin, pos-tokenBegin);
          switch ( tokenNum ) {
          case 0:
-            mCountryCode = token.toByteArray();
+            mCountryCode = token;
             break;
          case 1: {
             QString latStr, lonStr;
@@ -235,7 +235,7 @@ void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
                lonStr = token.mid(5);
             }
             else {
-               qWarning() << "can't parse lat lon str" << token.toByteArray();
+               qWarning() << "can't parse lat lon str" << token;
                return;
             }
 
@@ -249,10 +249,10 @@ void QTimeZoneLocation::getSystemTimeZoneLocation(const char *line)
          }
             break;
          case 2: {
-            mId = token.toByteArray();
+            mId = token;
          } break;
          case 3:
-            mDescription = token.toByteArray();
+            mDescription = token;
             break;
          }
 
commit a63d6c5ecc5c8187f411ce86ff4bfae23bbfd70f
Author: Lorn Potter <lorn.potter@nokia.com>
Date:   Tue Mar 31 10:05:55 2009 +1000

    change the argument for setTimeZone to accept a QString instead. might
    want to add a QTimeZone one as well in the future, but this simplifies
    it

diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index c8f96b1..9cf1c12 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -3328,7 +3328,15 @@ void QDateTime::detach()
 
 QDateTime QDateTime::toTimeZone(const QTimeZone &tz) const
 {
-    return d->tz.convert( QDateTime(d->date, d->time), tz);
+    if (tz.isValid()) {
+        QDateTime dt = d->tz.convert( QDateTime(d->date, d->time), tz);
+        if (dt.isValid()) {
+            qreal offset = tz.getUTCOffset( QDateTime(d->date, d->time));
+            dt.setUtcOffset(offset);
+            return dt;
+        }
+    }
+    return QDateTime();
 }
 
 bool QDateTime::isDst()
@@ -3342,10 +3350,27 @@ bool QDateTime::isDst()
 /*!
   Sets the current QDateTime to QTimeZone /a tz. If /a convertTime is false, it will not convert the time, default is to convert the time. Returns true if tz is valid.
 */
-bool QDateTime::setTimeZone(const QTimeZone &tz) const
+bool QDateTime::setTimeZone(const QString &tzs) const
 {
-    d->tz = tz;
-    return d->tz.isValid();
+    if(tzs.isEmpty())
+        return false;
+    QTimeZone tz(tzs);
+    if(tz.isValid()) {
+        d->tz = tz;
+        qreal offset = tz.getUTCOffset( QDateTime(d->date, d->time));
+            //        detach();
+            if(offset == 0)
+                d->spec = QDateTimePrivate::UTC;
+            else
+                d->spec = QDateTimePrivate::OffsetFromUTC;
+
+            d->utcOffset = offset;
+
+//        }//        setUtcOffset(offset);
+        return true;
+    }
+    else
+        return false;
 }
 
 /*!
@@ -3353,6 +3378,10 @@ bool QDateTime::setTimeZone(const QTimeZone &tz) const
 */
 QTimeZone QDateTime::getTimeZone() const
 {
+    if(!d->tz.isValid()) {
+        return  d->tz = QTimeZone("Etc/UTC");
+    }
+
     return d->tz;
 }
 #endif
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index c0bfc56..befe5ac 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -288,7 +288,7 @@ public:
 #endif
 #ifndef QT_BOOTSTRAPPED
 #ifndef QT_BUILD_QMAKE
-    bool setTimeZone(const QTimeZone &tz) const;
+    bool setTimeZone(const QString &tzs) const;
     QTimeZone getTimeZone() const;
 
     QDateTime toTimeZone(const QTimeZone &tz) const;
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index bab8db1..3d73a83 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -129,11 +129,10 @@ bool QTimeZoneData::isValid() const
 
 int QTimeZoneData::findTranstionTimeIndex( const QDateTime & c, bool utc ) const
 {
+//    qWarning() << __PRETTY_FUNCTION__ << id();
    QDateTime ct = c;
    ct.setTimeSpec(Qt::UTC);
-
    for ( int i = 0; i < (int)transitionTimes.count(); ++i ) {
-
       transitionInfo transTime = transitionTimes[i];
       ttinfo transInfo = timeTypes[ transTime.timeTypeIndex ];
 
@@ -143,27 +142,27 @@ int QTimeZoneData::findTranstionTimeIndex( const QDateTime & c, bool utc ) const
       if ( !utc )
          thisItTime = thisItTime.addSecs( transInfo.utcOffset );
 
-//      qWarning() <<"QTimeZoneData::findTranstionTimeIndex" << thisItTime << ct << "DST?" << transInfo.isDst << i;
+//      qWarning() <<"QTimeZoneData::findTranstionTimeIndex" << thisItTime
+//              << ct << "DST?" << transInfo.isDst << i;
 
       if(thisItTime > ct) {
-         // gone one too far; we've passed it. return the previous one, if
-         // it exists
+          //qWarning() <<"gone one too far; we've passed it. return the previous one, if it exists";
          if ( i > 0 )
             return i-1;
          return i;
       }
    }
    // must be the last index
-   return transitionTimes.count()-1;
+   return transitionTimes.count() - 1;
 }
 
 int QTimeZoneData::findTimeTypeIndex( const QDateTime & c, bool utc ) const
 {
    int transIndex = findTranstionTimeIndex( c, utc );
-//    qWarning() << "QTimeZoneData::findTimeTypeIndex" << transIndex;
-
-   if ( transIndex < 0 )
-      return 0;
+//   qWarning() << __PRETTY_FUNCTION__ << transIndex;
+   if ( transIndex < 0 ) {
+       return 0;
+   }
    return transitionTimes[ transIndex ].timeTypeIndex;
 }
 
@@ -206,8 +205,9 @@ bool QTimeZoneData::isDaylightSavings( const QDateTime & c ) const
 
 qint32 QTimeZoneData::utcOffSet( const QDateTime & c ) const
 {
-   ttinfo transInfo = timeTypes[ findTimeTypeIndex( c, false ) ];
-   return transInfo.utcOffset;
+    int index = findTimeTypeIndex( c, false );
+    ttinfo transInfo = timeTypes[ index];
+    return transInfo.utcOffset;
 }
 
 ////////////////////////////
@@ -257,7 +257,7 @@ QString QTimeZoneData::tzSetFormat(int stdIndex, int dstStartIndex, int dstEndIn
    // standard time
    const ttinfo &stdTime = timeTypes[transitionTimes[stdIndex].timeTypeIndex];
    if (stdTime.isDst) {
-      qWarning() << "stdIndex points to DST time.";
+  //    qWarning() << "stdIndex points to DST time.";
       return tz;
    }
 
@@ -276,13 +276,13 @@ QString QTimeZoneData::tzSetFormat(int stdIndex, int dstStartIndex, int dstEndIn
 
    const ttinfo &dstTimeStart = timeTypes[transitionTimes[dstStartIndex].timeTypeIndex];
    if (!dstTimeStart.isDst) {
-      qWarning() << "dstStartIndex points to STD time.";
+ //     qWarning() << "dstStartIndex points to STD time.";
       return tz;
    }
 
    const ttinfo &dstTimeEnd = timeTypes[transitionTimes[dstEndIndex].timeTypeIndex];
    if (dstTimeEnd.isDst) {
-      qWarning() << "dstEndIndex points to DST time.";
+   //   qWarning() << "dstEndIndex points to DST time.";
       return tz;
    }
 
@@ -707,13 +707,13 @@ QDateTime QTimeZone::convert( const QDateTime &dt, const QTimeZone &dtTz ) const
 //QDateTime QDateTime::toTimeZone(const QTimeZone &tz) const;
 
 // /*!
-//   Gets the UTC offset in number of hours for the date time /a c between this timezone and UTC.
+//   Gets the UTC offset in seconds for the date time /a c between this timezone and UTC.
 //   East of UTC would be negative (i.e. -9.5 UTC) and Westd
 
 qreal QTimeZone::getUTCOffset(const QDateTime &c) const
 {
    QTimeZoneData *data = d->data();
-   return (float)data->utcOffSet(c)/60/60;
+   return data->utcOffSet(c);///60/60;
 }
 /*!
   Returns true if the date time /a c in this timezone is under daylight saving rules, otherwise false;
commit 5357b1b054ef4053eaed9e9e279a7ecbddc46451
Author: Lorn Potter <lorn.potter@nokia.com>
Date:   Wed Apr 8 17:14:35 2009 +1000

    add winidtotzid stuff. tentively

diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 3d73a83..8be1f22 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -103,6 +103,7 @@ bool QTimeZoneData::matchAbbrev( const QDateTime &c,
 
    ttinfo transInfo = timeTypes[ findTimeTypeIndex( c, false ) ];
 
+   qWarning() << abbreviations[ transInfo.abbreviationIndex ];
    if ( mDstRule )
       return ( daylightAbbrev == abbreviations[ transInfo.abbreviationIndex ] );
 
diff --git a/src/corelib/tools/qtimezone_data.h b/src/corelib/tools/qtimezone_data.h
new file mode 100644
index 0000000..ddec144
--- /dev/null
+++ b/src/corelib/tools/qtimezone_data.h
@@ -0,0 +1,556 @@
+// Copyright (c) 2008-2078(s"," Tim Davis"," tim (at) timdavis.com.au - ISC Licence","
+//
+//Permission to use"," copy"," modify"," and/or distribute this software for any
+//purpose with or without fee is hereby granted"," provided that the above","
+//copyright notice and this permission notice appear in all copies.","","
+
+//THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES","","
+//WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF","","
+//MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR","","
+//ANY SPECIAL"," DIRECT"," INDIRECT"," OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+//WHATSOEVER RESULTING FROM LOSS OF USE"," DATA OR PROFITS"," WHETHER IN AN","
+//ACTION OF CONTRACT"," NEGLIGENCE OR OTHER TORTIOUS ACTION"," ARISING OUT OF","
+//OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+// http://www.timdavis.com.au/data/olson-time-zone-database-to-standard-windows-time-zone-v01/
+
+typedef struct 
+{
+   QString Tzid;
+   QString Winid;
+} WinidToTzid;
+
+static const  WinidToTzid timezone_tzid2win_data[] = {
+    {"Africa/Abidjan","Greenwich Standard Time"},
+    {"Africa/Accra","Greenwich Standard Time"},
+    {"Africa/Addis_Ababa","E. Africa Standard Time"},
+    {"Africa/Algiers","Central Europe Standard Time"},
+    {"Africa/Asmara","E. Africa Standard Time"},
+    {"Africa/Bamako","Greenwich Standard Time"},
+    {"Africa/Bangui","W. Central Africa Standard Time"},
+    {"Africa/Banjul","Greenwich Standard Time"},
+    {"Africa/Bissau","Greenwich Standard Time"},
+    {"Africa/Blantyre","South Africa Standard Time"},
+    {"Africa/Brazzaville","W. Central Africa Standard Time"},
+    {"Africa/Bujumbura","South Africa Standard Time"},
+    {"Africa/Cairo","Egypt Standard Time"},
+    {"Africa/Casablanca","Greenwich Standard Time"},
+    {"Africa/Ceuta","Central Europe Standard Time"},
+    {"Africa/Conakry","Greenwich Standard Time"},
+    {"Africa/Dakar","Greenwich Standard Time"},
+    {"Africa/Dar_es_Salaam","E. Africa Standard Time"},
+    {"Africa/Djibouti","E. Africa Standard Time"},
+    {"Africa/Douala","W. Central Africa Standard Time"},
+    {"Africa/El_Aaiun","Greenwich Standard Time"},
+    {"Africa/Freetown","Greenwich Standard Time"},
+    {"Africa/Gaborone","South Africa Standard Time"},
+    {"Africa/Harare","South Africa Standard Time"},
+    {"Africa/Johannesburg","South Africa Standard Time"},
+    {"Africa/Kampala","E. Africa Standard Time"},
+    {"Africa/Khartoum","E. Africa Standard Time"},
+    {"Africa/Kigali","South Africa Standard Time"},
+    {"Africa/Kinshasa","W. Central Africa Standard Time"},
+    {"Africa/Lagos","W. Central Africa Standard Time"},
+    {"Africa/Libreville","W. Central Africa Standard Time"},
+    {"Africa/Lome","Greenwich Standard Time"},
+    {"Africa/Luanda","W. Central Africa Standard Time"},
+    {"Africa/Lubumbashi","South Africa Standard Time"},
+    {"Africa/Lusaka","South Africa Standard Time"},
+    {"Africa/Malabo","W. Central Africa Standard Time"},
+    {"Africa/Maputo","South Africa Standard Time"},
+    {"Africa/Maseru","South Africa Standard Time"},
+    {"Africa/Mbabane","South Africa Standard Time"},
+    {"Africa/Mogadishu","E. Africa Standard Time"},
+    {"Africa/Monrovia","Greenwich Standard Time"},
+    {"Africa/Nairobi","E. Africa Standard Time"},
+    {"Africa/Ndjamena","W. Central Africa Standard Time"},
+    {"Africa/Niamey","W. Central Africa Standard Time"},
+    {"Africa/Nouakchott","Greenwich Standard Time"},
+    {"Africa/Ouagadougou","Greenwich Standard Time"},
+    {"Africa/Porto-Novo","W. Central Africa Standard Time"},
+    {"Africa/Sao_Tome","Greenwich Standard Time"},
+    {"Africa/Tripoli","South Africa Standard Time"},
+    {"Africa/Tunis","Central Europe Standard Time"},
+    {"Africa/Windhoek","W. Central Africa Standard Time"},
+    {"America/Adak","Hawaiian Standard Time"},
+    {"America/Anchorage","Alaskan Standard Time"},
+    {"America/Anguilla","Atlantic Standard Time"},
+    {"America/Antigua","Atlantic Standard Time"},
+    {"America/Araguaina","E. South America Standard Time"},
+    {"America/Argentina/Buenos_Aires","Argentina Standard Time"},
+    {"America/Argentina/Catamarca","Argentina Standard Time"},
+    {"America/Argentina/Cordoba","Argentina Standard Time"},
+    {"America/Argentina/Jujuy","Argentina Standard Time"},
+    {"America/Argentina/La_Rioja","Argentina Standard Time"},
+    {"America/Argentina/Mendoza","Argentina Standard Time"},
+    {"America/Argentina/Rio_Gallegos","Argentina Standard Time"},
+    {"America/Argentina/San_Juan","Argentina Standard Time"},
+    {"America/Argentina/San_Luis","Argentina Standard Time"},
+    {"America/Argentina/Tucuman","Argentina Standard Time"},
+    {"America/Argentina/Ushuaia","Argentina Standard Time"},
+    {"America/Aruba","Atlantic Standard Time"},
+    {"America/Asuncion","Central Brazilian Standard Time"},
+    {"America/Atikokan","Eastern Standard Time"},
+    {"America/Bahia","E. South America Standard Time"},
+    {"America/Barbados","Atlantic Standard Time"},
+    {"America/Belem","E. South America Standard Time"},
+    {"America/Belize","Central Standard Time (Mexico)"},
+    {"America/Blanc-Sablon","Atlantic Standard Time"},
+    {"America/Boa_Vista","Central Brazilian Standard Time"},
+    {"America/Bogota","SA Pacific Standard Time"},
+    {"America/Boise","Mountain Standard Time"},
+    {"America/Cambridge_Bay","Mountain Standard Time"},
+    {"America/Campo_Grande","SA Western Standard Time"},
+    {"America/Cancun","Central Standard Time (Mexico)"},
+    {"America/Caracas","Newfoundland Standard Time"},
+    {"America/Cayenne","SA Eastern Standard Time"},
+    {"America/Cayman","Eastern Standard Time"},
+    {"America/Chicago","Central Standard Time"},
+    {"America/Chihuahua","Mountain Standard Time (Mexico)"},
+    {"America/Costa_Rica","Central Standard Time (Mexico)"},
+    {"America/Cuiaba","SA Western Standard Time"},
+    {"America/Curacao","Atlantic Standard Time"},
+    {"America/Danmarkshavn","Greenwich Standard Time"},
+    {"America/Dawson","Pacific Standard Time"},
+    {"America/Dawson_Creek","Mountain Standard Time"},
+    {"America/Denver","Mountain Standard Time"},
+    {"America/Detroit","Eastern Standard Time"},
+    {"America/Dominica","Atlantic Standard Time"},
+    {"America/Edmonton","Mountain Standard Time"},
+    {"America/Eirunepe","SA Pacific Standard Time"},
+    {"America/El_Salvador","Central Standard Time (Mexico)"},
+    {"America/Fortaleza","E. South America Standard Time"},
+    {"America/Glace_Bay","Atlantic Standard Time"},
+    {"America/Godthab","Greenland Standard Time"},
+    {"America/Goose_Bay","Atlantic Standard Time"},
+    {"America/Grand_Turk","Eastern Standard Time"},
+    {"America/Grenada","Atlantic Standard Time"},
+    {"America/Guadeloupe","Atlantic Standard Time"},
+    {"America/Guatemala","Central Standard Time (Mexico)"},
+    {"America/Guayaquil","SA Pacific Standard Time"},
+    {"America/Guyana","SA Western Standard Time"},
+    {"America/Halifax","Atlantic Standard Time"},
+    {"America/Havana","SA Pacific Standard Time"},
+    {"America/Hermosillo","Mountain Standard Time"},
+    {"America/Indiana/Indianapolis","Eastern Standard Time"},
+    {"America/Indiana/Knox","Central Standard Time"},
+    {"America/Indiana/Marengo","Eastern Standard Time"},
+    {"America/Indiana/Petersburg","Eastern Standard Time"},
+    {"America/Indiana/Tell_City","Central Standard Time"},
+    {"America/Indiana/Vevay","Eastern Standard Time"},
+    {"America/Indiana/Vincennes","Eastern Standard Time"},
+    {"America/Indiana/Winamac","Eastern Standard Time"},
+    {"America/Inuvik","Mountain Standard Time"},
+    {"America/Iqaluit","Eastern Standard Time"},
+    {"America/Jamaica","Eastern Standard Time"},
+    {"America/Juneau","Alaskan Standard Time"},
+    {"America/Kentucky/Louisville","Eastern Standard Time"},
+    {"America/Kentucky/Monticello","Eastern Standard Time"},
+    {"America/La_Paz","SA Western Standard Time"},
+    {"America/Lima","SA Pacific Standard Time"},
+    {"America/Los_Angeles","Pacific Standard Time"},
+    {"America/Maceio","E. South America Standard Time"},
+    {"America/Managua","Central Standard Time (Mexico)"},
+    {"America/Manaus","Central Brazilian Standard Time"},
+    {"America/Martinique","Atlantic Standard Time"},
+    {"America/Mazatlan","Mountain Standard Time (Mexico)"},
+    {"America/Menominee","Central Standard Time (Mexico)"},
+    {"America/Merida","Central Standard Time (Mexico)"},
+    {"America/Mexico_City","Central Standard Time (Mexico)"},
+    {"America/Miquelon","Greenland Standard Time"},
+    {"America/Moncton","Atlantic Standard Time"},
+    {"America/Monterrey","Central Standard Time (Mexico)"},
+    {"America/Montevideo","Montevideo Standard Time"},
+    {"America/Montreal","Eastern Standard Time"},
+    {"America/Montserrat","Atlantic Standard Time"},
+    {"America/Nassau","Eastern Standard Time"},
+    {"America/New_York","Eastern Standard Time"},
+    {"America/Nipigon","Eastern Standard Time"},
+    {"America/Nome","Alaskan Standard Time"},
+    {"America/Noronha","Mid-Atlantic Standard Time"},
+    {"America/North_Dakota/Center","Central Standard Time"},
+    {"America/North_Dakota/New_Salem","Central Standard Time"},
+    {"America/Panama","Eastern Standard Time"},
+    {"America/Pangnirtung","Eastern Standard Time"},
+    {"America/Paramaribo","SA Eastern Standard Time"},
+    {"America/Phoenix","US Mountain Standard Time"},
+    {"America/Port_of_Spain","Atlantic Standard Time"},
+    {"America/Port-au-Prince","Eastern Standard Time"},
+    {"America/Porto_Velho","Central Brazilian Standard Time"},
+    {"America/Puerto_Rico","Atlantic Standard Time"},
+    {"America/Rainy_River","Central Standard Time"},
+    {"America/Rankin_Inlet","Central Standard Time"},
+    {"America/Recife","E. South America Standard Time"},
+    {"America/Regina","Central Standard Time"},
+    {"America/Resolute","Eastern Standard Time"},
+    {"America/Rio_Branco","SA Pacific Standard Time"},
+    {"America/Santiago","SA Western Standard Time"},
+    {"America/Santo_Domingo","Atlantic Standard Time"},
+    {"America/Sao_Paulo","E. South America Standard Time"},
+    {"America/Scoresbysund","Azores Standard Time"},
+    {"America/St_Johns","Newfoundland Standard Time"},
+    {"America/St_Kitts","Atlantic Standard Time"},
+    {"America/St_Lucia","Atlantic Standard Time"},
+    {"America/St_Thomas","Atlantic Standard Time"},
+    {"America/St_Vincent","Atlantic Standard Time"},
+    {"America/Swift_Current","Central Standard Time (Mexico)"},
+    {"America/Tegucigalpa","Central Standard Time (Mexico)"},
+    {"America/Thule","Atlantic Standard Time"},
+    {"America/Thunder_Bay","Eastern Standard Time"},
+    {"America/Tijuana","Pacific Standard Time (Mexico)"},
+    {"America/Toronto","Eastern Standard Time"},
+    {"America/Tortola","Atlantic Standard Time"},
+    {"America/Vancouver","Pacific Standard Time"},
+    {"America/Whitehorse","Pacific Standard Time"},
+    {"America/Winnipeg","Central Standard Time"},
+    {"America/Yakutat","Alaskan Standard Time"},
+    {"America/Yellowknife","Mountain Standard Time"},
+    {"Antarctica/Casey","W. Australia Standard Time"},
+    {"Antarctica/Davis","SE Asia Standard Time"},
+    {"Antarctica/DumontDUrville","E. Australia Standard Time"},
+    {"Antarctica/Mawson","Central Asia Standard Time"},
+    {"Antarctica/McMurdo","New Zealand Standard Time"},
+    {"Antarctica/Palmer","SA Western Standard Time"},
+    {"Antarctica/Rothera","SA Eastern Standard Time"},
+    {"Antarctica/Syowa","E. Africa Standard Time"},
+    {"Antarctica/Vostok","Central Asia Standard Time"},
+    {"Asia/Aden","Arabic Standard Time"},
+    {"Asia/Almaty","Central Asia Standard Time"},
+    {"Asia/Amman","Jordan Standard Time"},
+    {"Asia/Anadyr","New Zealand Standard Time"},
+    {"Asia/Aqtau","West Asia Standard Time"},
+    {"Asia/Aqtobe","West Asia Standard Time"},
+    {"Asia/Ashgabat","West Asia Standard Time"},
+    {"Asia/Baghdad","Arabic Standard Time"},
+    {"Asia/Bahrain","Arabic Standard Time"},
+    {"Asia/Baku","Azerbaijan Standard Time"},
+    {"Asia/Bangkok","SE Asia Standard Time"},
+    {"Asia/Beirut","Middle East Standard Time"},
+    {"Asia/Bishkek","Central Asia Standard Time"},
+    {"Asia/Brunei","North Asia East Standard Time"},
+    {"Asia/Choibalsan","Yakutsk Standard Time"},
+    {"Asia/Chongqing","China Standard Time"},
+    {"Asia/Colombo","Sri Lanka Standard Time"},
+    {"Asia/Damascus","Middle East Standard Time"},
+    {"Asia/Dhaka","N. Central Asia Standard Time"},
+    {"Asia/Dili","Korea Standard Time"},
+    {"Asia/Dubai","Arabian Standard Time"},
+    {"Asia/Dushanbe","West Asia Standard Time"},
+    {"Asia/Gaza","Middle East Standard Time"},
+    {"Asia/Harbin","China Standard Time"},
+    {"Asia/Ho_Chi_Minh","SE Asia Standard Time"},
+    {"Asia/Hong_Kong","Malay Peninsula Standard Time"},
+    {"Asia/Hovd","SE Asia Standard Time"},
+    {"Asia/Irkutsk","North Asia East Standard Time"},
+    {"Asia/Jakarta","SE Asia Standard Time"},
+    {"Asia/Jayapura","Korea Standard Time"},
+    {"Asia/Jerusalem","Middle East Standard Time"},
+    {"Asia/Kabul","Afghanistan Standard Time"},
+    {"Asia/Kamchatka","Fiji Standard Time"},
+    {"Asia/Karachi","West Asia Standard Time"},
+    {"Asia/Kashgar","China Standard Time"},
+    {"Asia/Katmandu","Nepal Standard Time"},
+    {"Asia/Kolkata","India Standard Time"},
+    {"Asia/Krasnoyarsk","North Asia Standard Time"},
+    {"Asia/Kuala_Lumpur","Malay Peninsula Standard Time"},
+    {"Asia/Kuching","Malay Peninsula Standard Time"},
+    {"Asia/Kuwait","Arabic Standard Time"},
+    {"Asia/Macau","China Standard Time"},
+    {"Asia/Magadan","Central Pacific Standard Time"},
+    {"Asia/Makassar","Malay Peninsula Standard Time"},
+    {"Asia/Manila","Malay Peninsula Standard Time"},
+    {"Asia/Muscat","Arabian Standard Time"},
+    {"Asia/Nicosia","Middle East Standard Time"},
+    {"Asia/Novosibirsk","N. Central Asia Standard Time"},
+    {"Asia/Omsk","N. Central Asia Standard Time"},
+    {"Asia/Oral","Ekaterinburg Standard Time"},
+    {"Asia/Phnom_Penh","SE Asia Standard Time"},
+    {"Asia/Pontianak","SE Asia Standard Time"},
+    {"Asia/Pyongyang","Korea Standard Time"},
+    {"Asia/Qatar","Arabic Standard Time"},
+    {"Asia/Qyzylorda","N. Central Asia Standard Time"},
+    {"Asia/Rangoon","Myanmar Standard Time"},
+    {"Asia/Riyadh","Arabic Standard Time"},
+    {"Asia/Sakhalin","Vladivostok Standard Time"},
+    {"Asia/Samarkand","West Asia Standard Time"},
+    {"Asia/Seoul","Korea Standard Time"},
+    {"Asia/Shanghai","China Standard Time"},
+    {"Asia/Singapore","Malay Peninsula Standard Time"},
+    {"Asia/Taipei","China Standard Time"},
+    {"Asia/Tashkent","West Asia Standard Time"},
+    {"Asia/Tbilisi","Arabian Standard Time"},
+    {"Asia/Tehran","Iran Standard Time"},
+    {"Asia/Thimphu","N. Central Asia Standard Time"},
+    {"Asia/Tokyo","Tokyo Standard Time"},
+    {"Asia/Ulaanbaatar","North Asia East Standard Time"},
+    {"Asia/Urumqi","China Standard Time"},
+    {"Asia/Vientiane","SE Asia Standard Time"},
+    {"Asia/Vladivostok","Vladivostok Standard Time"},
+    {"Asia/Yakutsk","Yakutsk Standard Time"},
+    {"Asia/Yekaterinburg","Ekaterinburg Standard Time"},
+    {"Asia/Yerevan","Caucasus Standard Time"},
+    {"Atlantic/Azores","Azores Standard Time"},
+    {"Atlantic/Bermuda","Atlantic Standard Time"},
+    {"Atlantic/Canary","W. Europe Standard Time"},
+    {"Atlantic/Cape_Verde","Cape Verde Standard Time"},
+    {"Atlantic/Faroe","W. Europe Standard Time"},
+    {"Atlantic/Madeira","W. Europe Standard Time"},
+    {"Atlantic/Reykjavik","Greenwich Standard Time"},
+    {"Atlantic/South_Georgia","Mid-Atlantic Standard Time"},
+    {"Atlantic/St_Helena","Greenwich Standard Time"},
+    {"Atlantic/Stanley","Pacific SA Standard Time"},
+    {"Australia/Adelaide","Cen. Australia Standard Time"},
+    {"Australia/Brisbane","E. Australia Standard Time"},
+    {"Australia/Broken_Hill","Cen. Australia Standard Time"},
+    {"Australia/Currie","Tasmania Standard Time"},
+    {"Australia/Darwin","AUS Central Standard Time"},
+    {"Australia/Eucla","Cen. Australia Standard Time"},
+    {"Australia/Hobart","Tasmania Standard Time"},
+    {"Australia/Lindeman","AUS Eastern Standard Time"},
+    {"Australia/Lord_Howe","Central Pacific Standard Time"},
+    {"Australia/Melbourne","AUS Eastern Standard Time"},
+    {"Australia/Perth","W. Australia Standard Time"},
+    {"Australia/Sydney","AUS Eastern Standard Time"},
+    {"CET","Central Europe Standard Time"},
+    {"CST6CDT","Central Standard Time"},
+    {"EET","E. Europe Standard Time"},
+    {"EST","Eastern Standard Time"},
+    {"EST5EDT","Eastern Standard Time"},
+    {"Etc/GMT","GMT Standard Time"},
+    {"Etc/UCT","GMT Standard Time"},
+    {"Etc/UTC","GMT Standard Time"},
+    {"Europe/Amsterdam","W. Europe Standard Time"},
+    {"Europe/Andorra","Central Europe Standard Time"},
+    {"Europe/Athens","E. Europe Standard Time"},
+    {"Europe/Belgrade","Central Europe Standard Time"},
+    {"Europe/Berlin","W. Europe Standard Time"},
+    {"Europe/Brussels","Central European Standard Time"},
+    {"Europe/Bucharest","E. Europe Standard Time"},
+    {"Europe/Budapest","Central European Standard Time"},
+    {"Europe/Chisinau","E. Europe Standard Time"},
+    {"Europe/Copenhagen","Central European Standard Time"},
+    {"Europe/Dublin","GMT Standard Time"},
+    {"Europe/Gibraltar","Central European Standard Time"},
+    {"Europe/Helsinki","E. Europe Standard Time"},
+    {"Europe/Istanbul","E. Europe Standard Time"},
+    {"Europe/Kaliningrad","E. Europe Standard Time"},
+    {"Europe/Kiev","E. Europe Standard Time"},
+    {"Europe/Lisbon","W. Europe Standard Time"},
+    {"Europe/London","GMT Standard Time"},
+    {"Europe/Luxembourg","Central European Standard Time"},
+    {"Europe/Madrid","Central European Standard Time"},
+    {"Europe/Malta","Central European Standard Time"},
+    {"Europe/Minsk","E. Europe Standard Time"},
+    {"Europe/Monaco","Central European Standard Time"},
+    {"Europe/Moscow","Russian Standard Time"},
+    {"Europe/Oslo","Central European Standard Time"},
+    {"Europe/Paris","Central European Standard Time"},
+    {"Europe/Prague","Central European Standard Time"},
+    {"Europe/Riga","E. Europe Standard Time"},
+    {"Europe/Rome","W. Europe Standard Time"},
+    {"Europe/Samara","Caucasus Standard Time"},
+    {"Europe/Simferopol","E. Europe Standard Time"},
+    {"Europe/Sofia","E. Europe Standard Time"},
+    {"Europe/Stockholm","W. Europe Standard Time"},
+    {"Europe/Tallinn","E. Europe Standard Time"},
+    {"Europe/Tirane","Central European Standard Time"},
+    {"Europe/Uzhgorod","E. Europe Standard Time"},
+    {"Europe/Vaduz","W. Europe Standard Time"},
+    {"Europe/Vienna","Central European Standard Time"},
+    {"Europe/Vilnius","E. Europe Standard Time"},
+    {"Europe/Volgograd","Russian Standard Time"},
+    {"Europe/Warsaw","Central European Standard Time"},
+    {"Europe/Zaporozhye","E. Europe Standard Time"},
+    {"Europe/Zurich","Central European Standard Time"},
+    {"HST","Hawaiian Standard Time"},
+    {"Indian/Antananarivo","E. Africa Standard Time"},
+    {"Indian/Chagos","Central Asia Standard Time"},
+    {"Indian/Christmas","SE Asia Standard Time"},
+    {"Indian/Cocos","Myanmar Standard Time"},
+    {"Indian/Comoro","E. Africa Standard Time"},
+    {"Indian/Kerguelen","West Asia Standard Time"},
+    {"Indian/Mahe","Arabian Standard Time"},
+    {"Indian/Maldives","West Asia Standard Time"},
+    {"Indian/Mauritius","Azerbaijan Standard Time"},
+    {"Indian/Mayotte","E. Africa Standard Time"},
+    {"Indian/Reunion","Arabian Standard Time"},
+    {"MET","Central European Standard Time"},
+    {"MST","Mountain Standard Time"},
+    {"MST7MDT","US Mountain Standard Time"},
+    {"Pacific/Apia","Samoa Standard Time"},
+    {"Pacific/Auckland","New Zealand Standard Time"},
+    {"Pacific/Chatham","Fiji Standard Time"},
+    {"Pacific/Easter","Central Standard Time (Mexico)"},
+    {"Pacific/Efate","Central Pacific Standard Time"},
+    {"Pacific/Enderbury","Tonga Standard Time"},
+    {"Pacific/Fakaofo","Hawaiian Standard Time"},
+    {"Pacific/Fiji","Fiji Standard Time"},
+    {"Pacific/Funafuti","Fiji Standard Time"},
+    {"Pacific/Galapagos","Central Standard Time"},
+    {"Pacific/Gambier","Alaskan Standard Time"},
+    {"Pacific/Guadalcanal","Central Pacific Standard Time"},
+    {"Pacific/Guam","West Pacific Standard Time"},
+    {"Pacific/Honolulu","Hawaiian Standard Time"},
+    {"Pacific/Johnston","Hawaiian Standard Time"},
+    {"Pacific/Kiritimati","Tonga Standard Time"},
+    {"Pacific/Kosrae","Central Pacific Standard Time"},
+    {"Pacific/Kwajalein","Fiji Standard Time"},
+    {"Pacific/Majuro","Fiji Standard Time"},
+    {"Pacific/Marquesas","Pacific Standard Time (Mexico)"},
+    {"Pacific/Midway","Samoa Standard Time"},
+    {"Pacific/Nauru","Fiji Standard Time"},
+    {"Pacific/Niue","Samoa Standard Time"},
+    {"Pacific/Norfolk","Central Pacific Standard Time"},
+    {"Pacific/Noumea","Central Pacific Standard Time"},
+    {"Pacific/Pago_Pago","Samoa Standard Time"},
+    {"Pacific/Palau","Tokyo Standard Time"},
+    {"Pacific/Pitcairn","Pacific Standard Time"},
+    {"Pacific/Ponape","Central Pacific Standard Time"},
+    {"Pacific/Port_Moresby","West Pacific Standard Time"},
+    {"Pacific/Rarotonga","Hawaiian Standard Time"},
+    {"Pacific/Saipan","West Pacific Standard Time"},
+    {"Pacific/Tahiti","Hawaiian Standard Time"},
+    {"Pacific/Tarawa","Fiji Standard Time"},
+    {"Pacific/Tongatapu","Tonga Standard Time"},
+    {"Pacific/Truk","West Pacific Standard Time"},
+    {"Pacific/Wake","Fiji Standard Time"},
+    {"Pacific/Wallis","Fiji Standard Time"},
+    {"PST8PDT","Pacific Standard Time"},
+    {"WET","W. Europe Standard Time"},
+    {"Etc/GMT+9","Alaskan Standard Time"},
+    {"Asia/Riyadh87","Arabic Standard Time"},
+    {"Asia/Riyadh88","Arabic Standard Time"},
+    {"Asia/Riyadh89","Arabic Standard Time"},
+    {"Etc/GMT+4","Atlantic Standard Time"},
+    {"Etc/GMT-10","AUS Eastern Standard Time"},
+    {"Etc/GMT-4","Azerbaijan Standard Time"},
+    {"Etc/GMT+1","Azores Standard Time"},
+    {"Etc/GMT-1","Central Europe Standard Time"},
+    {"Etc/GMT-11","Central Pacific Standard Time"},
+    {"Etc/GMT+6","Central Standard Time"},
+    {"Etc/GMT+12","Dateline Standard Time"},
+    {"Etc/GMT-2","E. Europe Standard Time"},
+    {"Etc/GMT+3","E. South America Standard Time"},
+    {"Etc/GMT+5","Eastern Standard Time"},
+    {"Etc/GMT-5","Ekaterinburg Standard Time"},
+    {"Etc/GMT+10","Hawaiian Standard Time"},
+    {"Etc/GMT+2","Mid-Atlantic Standard Time"},
+    {"Etc/GMT+7","Mountain Standard Time"},
+    {"Etc/GMT-6","N. Central Asia Standard Time"},
+    {"Etc/GMT-12","New Zealand Standard Time"},
+    {"Etc/GMT-7","North Asia Standard Time"},
+    {"Etc/GMT+8","Pacific Standard Time"},
+    {"Etc/GMT-3","Russian Standard Time"},
+    {"Etc/GMT+11","Samoa Standard Time"},
+    {"Etc/GMT-13","Tonga Standard Time"},
+    {"Etc/GMT-14","Tonga Standard Time"},
+    {"Etc/GMT-8","W. Australia Standard Time"},
+    {"Etc/GMT-9","Yakutsk Standard Time"}
+};
+
+
+// Windows-Tzid table shows the mapping from Windows timezone IDs to the standard TZIDs.
+// data from http://unicode.org/cldr/data/diff/supplemental/windows_tzid.html
+// http://unicode.org/copyright.html/Exhibit1
+
+typedef struct 
+{
+    QString Winid;
+    QString Tzid;
+} TzidToWinid;
+
+
+static const TzidToWinid timezone_win2tzid_data[] = {
+    {"AUS Central Standard Time","Australia/Darwin"},
+    {"AUS Eastern Standard Time","Australia/Sydney"},
+    {"Afghanistan Standard Time","Asia/Kabul"},
+    {"Alaskan Standard Time","America/Anchorage"},
+    {"Arab Standard Time","Asia/Riyadh"},
+    {"Arabian Standard Time","Asia/Dubai"},
+    {"Arabic Standard Time","Asia/Baghdad"},
+    {"Argentina Standard Time","America/Buenos_Aires"},
+    {"Armenian Standard Time","Asia/Yerevan"},
+    {"Atlantic Standard Time","America/Halifax"},
+    {"Azerbaijan Standard Time","Asia/Baku"},
+    {"Azores Standard Time","Atlantic/Azores"},
+    {"Canada Central Standard Time","America/Regina"},
+    {"Cape Verde Standard Time","Atlantic/Cape_Verde"},
+    {"Caucasus Standard Time","Asia/Tbilisi"},
+    {"Cen. Australia Standard Time","Australia/Adelaide"},
+    {"Central America Standard Time","America/Guatemala"},
+    {"Central Asia Standard Time","Asia/Dhaka"},
+    {"Central Brazilian Standard Time","America/Manaus"},
+    {"Central Europe Standard Time","Europe/Budapest"},
+    {"Central European Standard Time","Europe/Warsaw"},
+    {"Central Pacific Standard Time","Pacific/Guadalcanal"},
+    {"Central Standard Time","America/Chicago"},
+    {"Central Standard Time (Mexico)","America/Mexico_City"},
+    {"China Standard Time","Asia/Shanghai"},
+    {"Dateline Standard Time","Etc/GMT+12"},
+    {"E. Africa Standard Time","Africa/Nairobi"},
+    {"E. Australia Standard Time","Australia/Brisbane"},
+    {"E. Europe Standard Time","Europe/Minsk"},
+    {"E. South America Standard Time","America/Sao_Paulo"},
+    {"Eastern Standard Time","America/New_York"},
+    {"Egypt Standard Time","Africa/Cairo"},
+    {"Ekaterinburg Standard Time","Asia/Yekaterinburg"},
+    {"FLE Standard Time","Europe/Kiev"},
+    {"Fiji Standard Time","Pacific/Fiji"},
+    {"GMT Standard Time","Europe/London"},
+    {"GTB Standard Time","Europe/Istanbul"},
+    {"Georgian Standard Time","Etc/GMT-3"},
+    {"Greenland Standard Time","America/Godthab"},
+    {"Greenwich Standard Time","Africa/Casablanca"},
+    {"Hawaiian Standard Time","Pacific/Honolulu"},
+    {"India Standard Time","Asia/Calcutta"},
+    {"Iran Standard Time","Asia/Tehran"},
+    {"Israel Standard Time","Asia/Jerusalem"},
+    {"Jordan Standard Time","Asia/Amman"},
+    {"Korea Standard Time","Asia/Seoul"},
+    {"Mexico Standard Time","America/Mexico_City"},
+    {"Mexico Standard Time 2","America/Chihuahua"},
+    {"Mid-Atlantic Standard Time","Atlantic/South_Georgia"},
+    {"Middle East Standard Time","Asia/Beirut"},
+    {"Montevideo Standard Time","America/Montevideo"},
+    {"Mountain Standard Time","America/Denver"},
+    {"Mountain Standard Time (Mexico)","America/Chihuahua"},
+    {"Myanmar Standard Time","Asia/Rangoon"},
+    {"N. Central Asia Standard Time","Asia/Novosibirsk"},
+    {"Namibia Standard Time","Africa/Windhoek"},
+    {"Nepal Standard Time","Asia/Katmandu"},
+    {"New Zealand Standard Time","Pacific/Auckland"},
+    {"Newfoundland Standard Time","America/St_Johns"},
+    {"North Asia East Standard Time","Asia/Irkutsk"},
+    {"North Asia Standard Time","Asia/Krasnoyarsk"},
+    {"Pacific SA Standard Time","America/Santiago"},
+    {"Pacific Standard Time","America/Los_Angeles"},
+    {"Pacific Standard Time (Mexico)","America/Tijuana"},
+    {"Romance Standard Time","Europe/Paris"},
+    {"Russian Standard Time","Europe/Moscow"},
+    {"SA Eastern Standard Time","Etc/GMT+3"},
+    {"SA Pacific Standard Time","America/Bogota"},
+    {"SA Western Standard Time","America/La_Paz"},
+    {"SE Asia Standard Time","Asia/Bangkok"},
+    {"Samoa Standard Time","Pacific/Apia"},
+    {"Singapore Standard Time","Asia/Singapore"},
+    {"South Africa Standard Time","Africa/Johannesburg"},
+    {"Sri Lanka Standard Time","Asia/Colombo"},
+    {"Taipei Standard Time","Asia/Taipei"},
+    {"Tasmania Standard Time","Australia/Hobart"},
+    {"Tokyo Standard Time","Asia/Tokyo"},
+    {"Tonga Standard Time","Pacific/Tongatapu"},
+    {"US Eastern Standard Time","Etc/GMT+5"},
+    {"US Mountain Standard Time","America/Phoenix"},
+    {"Venezuela Standard Time","America/Caracas"},
+    {"Vladivostok Standard Time","Asia/Vladivostok"},
+    {"W. Australia Standard Time","Australia/Perth"},
+    {"W. Central Africa Standard Time","Africa/Lagos"},
+    {"W. Europe Standard Time","Europe/Berlin"},
+    {"West Asia Standard Time","Asia/Karachi"},
+    {"West Pacific Standard Time","Pacific/Port_Moresby"},
+    {"Yakutsk Standard Time","Asia/Yakutsk"}
+};
+
+//static const int TzidToWinidCount =
+ //   sizeof(TzidToWinid)sizeof(TzidToWinid[0]);
+
+
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 523097b..d5c5b06 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -34,8 +34,8 @@ HEADERS +=  \
 	tools/qstringmatcher.h \
 	tools/qtextboundaryfinder.h \
 	tools/qtimeline.h \
-    tools/qtimezone.h \
-    tools/qtimezone_p.h \
+        tools/qtimezone.h \
+        tools/qtimezone_p.h \
 	tools/qunicodetables_p.h \
 	tools/qvarlengtharray.h \
 	tools/qvector.h
@@ -64,7 +64,7 @@ SOURCES += \
 	tools/qstringlist.cpp \
 	tools/qtextboundaryfinder.cpp \
 	tools/qtimeline.cpp \
-    tools/qtimezone.cpp \
+        tools/qtimezone.cpp \
 	tools/qvector.cpp \
         tools/qvsnprintf.cpp
 
@@ -108,7 +108,9 @@ HEADERS += tools/qharfbuzz_p.h
 
 
 win32 {
-SOURCES += tools/qtimezone_win.cpp
+# since we provide precompiled zoneinfo for windows...
+SOURCES += tools/qtimezone_unix.cpp
+#SOURCES += tools/qtimezone_win.cpp
 }
 
 symbian {
