Changeset 561 for trunk/src/corelib/tools/qdatetime.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/corelib/tools/qdatetime.cpp
r79 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 50 50 #include "qdebug.h" 51 51 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) 52 #include < windows.h>52 #include <windows.h> 53 53 #endif 54 54 #ifndef Q_WS_WIN … … 72 72 #if defined(Q_WS_MAC) 73 73 #include <private/qcore_mac_p.h> 74 75 76 77 74 78 #endif 75 79 … … 194 198 \brief The QDate class provides date functions. 195 199 196 \ingroup time197 \mainclass198 200 199 201 A QDate object contains a calendar date, i.e. year, month, and day … … 1131 1133 GetLocalTime(&st); 1132 1134 d.jd = julianDayFromDate(st.wYear, st.wMonth, st.wDay); 1135 1136 1137 1138 1139 1140 1133 1141 #else 1134 1142 // posix compliant system … … 1412 1420 \brief The QTime class provides clock time functions. 1413 1421 1414 \ingroup time1415 \mainclass1416 1422 1417 1423 A QTime object contains a clock time, i.e. the number of hours, … … 1828 1834 ct.startTick = GetTickCount() % MSECS_PER_DAY; 1829 1835 #endif 1836 1837 1838 1839 1840 1841 1830 1842 #elif defined(Q_OS_UNIX) || (defined(Q_OS_OS2) && defined(Q_CC_GNU)) 1831 1843 // posix compliant system … … 1843 1855 t = localtime(<ime); 1844 1856 #endif 1857 1845 1858 1846 1859 ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec … … 1849 1862 time_t ltime; // no millisecond resolution 1850 1863 ::time(<ime); 1851 tm *t = 0; 1852 t = localtime(<ime); 1864 const tm *const t = localtime(<ime); 1853 1865 ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec; 1854 1866 #endif … … 2076 2088 \brief The QDateTime class provides date and time functions. 2077 2089 2078 \ingroup time2079 \mainclass2080 2090 2081 2091 A QDateTime object contains a calendar date and a clock time (a … … 2201 2211 */ 2202 2212 QDateTime::QDateTime() 2203 { 2204 d = new QDateTimePrivate; 2213 : d(new QDateTimePrivate) 2214 { 2205 2215 } 2206 2216 … … 2212 2222 2213 2223 QDateTime::QDateTime(const QDate &date) 2214 { 2215 d = new QDateTimePrivate; 2224 : d(new QDateTimePrivate) 2225 { 2216 2226 d->date = date; 2217 2227 d->time = QTime(0, 0, 0); … … 2226 2236 2227 2237 QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec) 2228 { 2229 d = new QDateTimePrivate; 2238 : d(new QDateTimePrivate) 2239 { 2230 2240 d->date = date; 2231 2241 d->time = date.isValid() && !time.isValid() ? QTime(0, 0, 0) : time; … … 2238 2248 2239 2249 QDateTime::QDateTime(const QDateTime &other) 2240 { 2241 d = other.d; 2242 d->ref.ref(); 2250 : d(other.d) 2251 { 2243 2252 } 2244 2253 … … 2248 2257 QDateTime::~QDateTime() 2249 2258 { 2250 if (!d->ref.deref())2251 delete d;2252 2259 } 2253 2260 … … 2259 2266 QDateTime &QDateTime::operator=(const QDateTime &other) 2260 2267 { 2261 qAtomicAssign(d, other.d);2268 ; 2262 2269 return *this; 2263 2270 } … … 2505 2512 buf += QString::number(d->date.day()); 2506 2513 #else 2507 QString winstr; 2508 QT_WA({ 2509 TCHAR out[255]; 2510 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILDATE, out, 255); 2511 winstr = QString::fromUtf16((ushort*)out); 2512 } , { 2513 char out[255]; 2514 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ILDATE, (char*)&out, 255); 2515 winstr = QString::fromLocal8Bit(out); 2516 }); 2514 wchar_t out[255]; 2515 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILDATE, out, 255); 2516 QString winstr = QString::fromWCharArray(out); 2517 2517 switch (winstr.toInt()) { 2518 2518 case 1: … … 2891 2891 + st.wMilliseconds; 2892 2892 return QDateTime(d, t); 2893 2894 2893 2895 #else 2894 2896 #if defined(Q_OS_UNIX) || (defined(Q_OS_OS2) && defined(Q_CC_GNU)) … … 3300 3302 void QDateTime::detach() 3301 3303 { 3302 qAtomicDetach(d);3304 ); 3303 3305 } 3304 3306 … … 3718 3720 res.tm_year = sysTime.wYear - 1900; 3719 3721 brokenDown = &res; 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3720 3743 #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) 3721 3744 // use the reentrant version of localtime() where available … … 3763 3786 localTM.tm_year = fakeDate.year() - 1900; 3764 3787 localTM.tm_isdst = (int)isdst; 3765 #if defined(Q_OS_WINCE) 3788 #if defined(Q_OS_WINCE) 3766 3789 time_t secsSince1Jan1970UTC = toTime_tHelper(fakeDate, time); 3767 3790 #else … … 3788 3811 res.tm_isdst = (int)isdst; 3789 3812 brokenDown = &res; 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3790 3834 #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) 3791 3835 // use the reentrant version of gmtime() where available … … 3835 3879 QDebug operator<<(QDebug dbg, const QDate &date) 3836 3880 { 3837 dbg.nospace() << "QDate(" << date.toString() << ")";3881 dbg.nospace() << "QDate(" << date.toString() << ; 3838 3882 return dbg.space(); 3839 3883 } … … 3841 3885 QDebug operator<<(QDebug dbg, const QTime &time) 3842 3886 { 3843 dbg.nospace() << "QTime(" << time.toString() << ")";3887 dbg.nospace() << "QTime(" << time.toString() << ; 3844 3888 return dbg.space(); 3845 3889 } … … 3847 3891 QDebug operator<<(QDebug dbg, const QDateTime &date) 3848 3892 { 3849 dbg.nospace() << "QDateTime(" << date.toString() << ")";3893 dbg.nospace() << "QDateTime(" << date.toString() << ; 3850 3894 return dbg.space(); 3851 3895 } … … 4400 4444 qWarning("QDateTimeParser::sectionMaxSize: Invalid section %s", 4401 4445 sectionName(s).toLatin1().constData()); 4446 4447 4448 4449 4450 4451 4452 4402 4453 } 4403 4454 return -1; … … 4690 4741 const FieldInfo fi = fieldInfo(index); 4691 4742 if ((fi & (Numeric|FixedWidth)) == (Numeric|FixedWidth)) { 4692 const QString newText = QString (QLatin1String("%1")).arg(num, sn.count, 10, QLatin1Char('0'));4743 const QString newText = QString).arg(num, sn.count, 10, QLatin1Char('0')); 4693 4744 input.replace(pos, used, newText); 4694 4745 used = sn.count;
Note:
See TracChangeset
for help on using the changeset viewer.