X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWTF%2Fwtf%2FDateMath.cpp;h=6ee36d3c5fac57791b77b11d8178bc5243df8b5b;hp=c81dddf67bae496628f004a787fa05d68af2dfb3;hb=56b7a40fe27ee5dab4fd86d874cf1af5f2959639;hpb=8188f9fd39b1901f20226654bc80d5a700776435 diff --git a/Source/WTF/wtf/DateMath.cpp b/Source/WTF/wtf/DateMath.cpp index c81dddf..6ee36d3 100644 --- a/Source/WTF/wtf/DateMath.cpp +++ b/Source/WTF/wtf/DateMath.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006-2007, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 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) @@ -109,6 +109,10 @@ namespace WTF { /* Constants */ static const double maxUnixTime = 2145859200.0; // 12/31/2037 +// ECMAScript asks not to support for a date of which total +// millisecond value is larger than the following value. +// See 15.9.1.14 of ECMA-262 5th edition. +static const double maxECMAScriptTime = 8.64E15; // Day of year for the first day of each month, where index 0 is January, and day 0 is January 1. // First for non-leap years, then for leap years. @@ -180,7 +184,6 @@ static void appendTwoDigitNumber(StringBuilder& builder, int number) int msToYear(double ms) { - ASSERT(fabs(ms) <= maxECMAScriptTime); int approxYear = static_cast(floor(ms / (msPerDay * 365.2425)) + 1970); double msFromApproxYearTo1970 = msPerDay * daysFrom1970ToYear(approxYear); if (msFromApproxYearTo1970 > ms) @@ -327,7 +330,7 @@ static inline int minimumYearForDST() } /* - * Find an equivalent year for the one given, where equivalence is determined by + * Find an equivalent year for the one given, where equivalence is deterined by * the two years having the same leapness and the first day of the year, falling * on the same day of the week. * @@ -793,6 +796,7 @@ double parseES5DateFromNullTerminatedCharacters(const char* dateString) return dateSeconds * msPerSecond; } +// Odd case where 'exec' is allowed to be 0, to accomodate a caller in WebCore. double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveTZ, int& offset) { haveTZ = false;