Changeset 54256 in webkit
- Timestamp:
- Feb 2, 2010 2:50:41 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54250 r54256 1 2010-02-02 Kwang Yul Seo <skyul@company100.net> 2 3 Reviewed by Eric Seidel. 4 5 Use WTF::getLocalTime instead of localtime_r in FTPDirectoryDocument 6 https://bugs.webkit.org/show_bug.cgi?id=34409 7 8 Platform guards for localtime_r are not needed because we already have 9 WTF::getLocalTime which does the same thing. 10 11 * loader/FTPDirectoryDocument.cpp: 12 (WebCore::processFileDateString): 13 * loader/FTPDirectoryParser.cpp: 14 (WebCore::gmtimeQt): 15 1 16 2010-02-02 Adam Roben <aroben@apple.com> 2 17 -
trunk/WebCore/loader/FTPDirectoryDocument.cpp
r52791 r54256 39 39 #include "SharedBuffer.h" 40 40 #include "Text.h" 41 42 #include <wtf/CurrentTime.h> 41 43 #include <wtf/StdLibExtras.h> 42 43 #if PLATFORM(QT)44 #include <QDateTime>45 // On Windows, use the threadsafe *_r functions provided by pthread.46 #elif OS(WINDOWS) && (USE(PTHREADS) || HAVE(PTHREAD_H))47 #include <pthread.h>48 #endif49 44 50 45 using namespace std; … … 201 196 } 202 197 203 #if PLATFORM(QT)204 205 /*!206 Replacement for localtime_r() which is not available on MinGW.207 208 We use this on all of Qt's platforms for portability.209 */210 struct tm gmtimeQt(const QDateTime &input)211 {212 tm result;213 214 const QDate date(input.date());215 result.tm_year = date.year() - 1900;216 result.tm_mon = date.month();217 result.tm_mday = date.day();218 result.tm_wday = date.dayOfWeek();219 result.tm_yday = date.dayOfYear();220 221 const QTime time(input.time());222 result.tm_sec = time.second();223 result.tm_min = time.minute();224 result.tm_hour = time.hour();225 226 return result;227 }228 229 static struct tm *localTimeQt(const time_t *const timep, struct tm *result)230 {231 const QDateTime dt(QDateTime::fromTime_t(*timep));232 *result = WebCore::gmtimeQt(dt.toLocalTime());233 return result;234 }235 236 #define localtime_r(x, y) localTimeQt(x, y)237 #elif OS(WINDOWS) && !defined(localtime_r)238 #if defined(_MSC_VER) && (_MSC_VER >= 1400)239 #define localtime_r(x, y) localtime_s((y), (x))240 #else /* !_MSC_VER */241 #define localtime_r(x,y) (localtime(x)?(*(y)=*localtime(x),(y)):0)242 #endif243 #endif244 245 198 static String processFileDateString(const FTPTime& fileTime) 246 199 { … … 268 221 struct tm now; 269 222 time_t now_t = time(NULL); 270 localtime_r(&now_t, &now);223 getLocalTime(&now_t, &now); 271 224 272 225 // localtime does "year = current year - 1900", compensate for that for readability and comparison purposes -
trunk/WebCore/loader/FTPDirectoryParser.cpp
r53809 r54256 39 39 namespace WebCore { 40 40 #if PLATFORM(QT) && defined(Q_WS_WIN32) 41 // Defined in FTPDirectoryDocument.cpp. 42 struct tm gmtimeQt(const QDateTime &input); 41 42 // Replacement for gmtime_r() which is not available on MinGW. 43 // We use this on Win32 Qt platform for portability. 44 struct tm gmtimeQt(const QDateTime& input) 45 { 46 tm result; 47 48 QDate date(input.date()); 49 result.tm_year = date.year() - 1900; 50 result.tm_mon = date.month(); 51 result.tm_mday = date.day(); 52 result.tm_wday = date.dayOfWeek(); 53 result.tm_yday = date.dayOfYear(); 54 55 QTime time(input.time()); 56 result.tm_sec = time.second(); 57 result.tm_min = time.minute(); 58 result.tm_hour = time.hour(); 59 60 return result; 61 } 43 62 44 63 static struct tm *gmtimeQt(const time_t *const timep, struct tm *result)
Note: See TracChangeset
for help on using the changeset viewer.