summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/DateConversion.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-24 17:03:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-24 17:03:20 +0200
commit08d4a74d56ca431877819fc4566e27eafe150342 (patch)
treeebd8530838ab390c015c6b7e659a22852c1663ae /Source/JavaScriptCore/runtime/DateConversion.cpp
parent1de6cd4794bbd5a52189384189a2b8df1848b39b (diff)
downloadqtwebkit-08d4a74d56ca431877819fc4566e27eafe150342.tar.gz
Imported WebKit commit 0fbd41c4e13f5a190faf160bf993eee614e6e18e (http://svn.webkit.org/repository/webkit/trunk@123477)
New snapshot that adapts to latest Qt API changes
Diffstat (limited to 'Source/JavaScriptCore/runtime/DateConversion.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/DateConversion.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp
index 7bc0cbc0f..e8714c14c 100644
--- a/Source/JavaScriptCore/runtime/DateConversion.cpp
+++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
@@ -55,53 +55,41 @@ using namespace WTF;
namespace JSC {
-double parseDate(ExecState* exec, const UString &date)
-{
- if (date == exec->globalData().cachedDateString)
- return exec->globalData().cachedDateStringValue;
- double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
- if (isnan(value))
- value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
- exec->globalData().cachedDateString = date;
- exec->globalData().cachedDateStringValue = value;
- return value;
-}
-
void formatDate(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
snprintf(buffer, DateConversionBufferSize, "%s %s %02d %04d",
- weekdayName[(t.weekDay + 6) % 7],
- monthName[t.month], t.monthDay, t.year + 1900);
+ weekdayName[(t.weekDay() + 6) % 7],
+ monthName[t.month()], t.monthDay(), t.year() + 1900);
}
void formatDateUTCVariant(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
snprintf(buffer, DateConversionBufferSize, "%s, %02d %s %04d",
- weekdayName[(t.weekDay + 6) % 7],
- t.monthDay, monthName[t.month], t.year + 1900);
+ weekdayName[(t.weekDay() + 6) % 7],
+ t.monthDay(), monthName[t.month()], t.year() + 1900);
}
void formatTime(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
- int offset = abs(gmtoffset(t));
+ int offset = abs(t.utcOffset());
char timeZoneName[70];
struct tm gtm = t;
strftime(timeZoneName, sizeof(timeZoneName), "%Z", &gtm);
if (timeZoneName[0]) {
snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT%c%02d%02d (%s)",
- t.hour, t.minute, t.second,
- gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, timeZoneName);
+ t.hour(), t.minute(), t.second(),
+ t.utcOffset() < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, timeZoneName);
} else {
snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT%c%02d%02d",
- t.hour, t.minute, t.second,
- gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
+ t.hour(), t.minute(), t.second(),
+ t.utcOffset() < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
}
}
void formatTimeUTC(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
- snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT", t.hour, t.minute, t.second);
+ snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT", t.hour(), t.minute(), t.second());
}
} // namespace JSC