/*
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
- * Copyright (C) 2006-2007, 2012, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (C) 2007-2009 Torch Mobile, Inc.
* Copyright (C) 2010 &yet, LLC. (nate@andyet.net)
double start = cache.start;
double end = cache.end;
- ASSERT(fabs(ms) <= WTF::maxECMAScriptTime);
if (start <= ms) {
// If the time fits in the cached interval, return the cached offset.
if (ms <= end) return cache.offset;
// Compute a possible new interval end.
double newEnd = end + cache.increment;
- if (ms <= newEnd && newEnd <= WTF::maxECMAScriptTime) {
+ if (ms <= newEnd) {
LocalTimeOffset endOffset = calculateLocalTimeOffset(newEnd);
if (cache.offset == endOffset) {
// If the offset at the end of the new interval still matches
double ms = timeToMS(t.hour(), t.minute(), t.second(), milliSeconds);
double result = (day * WTF::msPerDay) + ms;
- if (fabs(result) > WTF::maxECMAScriptTime)
- return std::numeric_limits<double>::quiet_NaN();
-
if (!inputIsUTC)
result -= localTimeOffset(vm, result).offset;
- return timeClip(result);
+ return result;
}
// input is UTC
void msToGregorianDateTime(VM& vm, double ms, bool outputIsUTC, GregorianDateTime& tm)
{
- ASSERT(fabs(ms) <= WTF::maxECMAScriptTime);
LocalTimeOffset localTime;
if (!outputIsUTC) {
localTime = localTimeOffset(vm, ms);
tm.setUtcOffset(localTime.offset / WTF::msPerSecond);
}
-static double parseDateFromNullTerminatedCharacters(VM& vm, const char* dateString)
+double parseDateFromNullTerminatedCharacters(VM& vm, const char* dateString)
{
bool haveTZ;
int offset;
double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
- if (std::isnan(ms) || fabs(ms) > WTF::maxECMAScriptTime)
- return std::numeric_limits<double>::quiet_NaN();
+ if (std::isnan(ms))
+ return QNaN;
// fall back to local timezone
if (!haveTZ)
double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
if (std::isnan(value))
value = parseDateFromNullTerminatedCharacters(vm, date.utf8().data());
- value = timeClip(value);
vm.cachedDateString = date;
vm.cachedDateStringValue = value;
return value;