<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[19943] trunk/JavaScriptCore</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/19943">19943</a></dd>
<dt>Author</dt> <dd>darin</dd>
<dt>Date</dt> <dd>2007-03-02 09:42:20 -0800 (Fri, 02 Mar 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Kevin McCullough.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12867
          REGRESSION: BenchJS test 7 (dates) is 220% slower than in Safari 2.0.4

        * kjs/DateMath.h: Marked GregorianDateTime as noncopyable, since it has a non-trivial
        destructor and not the correspoding copy constructor or assignment operator.
        Changed the GregorianDateTime constructor to use member initialization syntax.
        Fixed the destructor to use the array delete operator, since timeZone is an array.

        * kjs/DateMath.cpp:
        (KJS::daysInYear): Changed to call isLeapYear so the rule is not repeated twice.
        (KJS::getUTCOffset): Added caching on PLATFORM(DARWIN), since we can rely on the
        notify_check function and &quot;com.apple.system.timezone&quot; to let us know when the
        offset has changed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCorekjsDateMathcpp">trunk/JavaScriptCore/kjs/DateMath.cpp</a></li>
<li><a href="#trunkJavaScriptCorekjsDateMathh">trunk/JavaScriptCore/kjs/DateMath.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (19942 => 19943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog        2007-03-02 09:39:34 UTC (rev 19942)
+++ trunk/JavaScriptCore/ChangeLog        2007-03-02 17:42:20 UTC (rev 19943)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2007-03-02  Darin Adler  &lt;darin@apple.com&gt;
+
+        Reviewed by Kevin McCullough.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=12867
+          REGRESSION: BenchJS test 7 (dates) is 220% slower than in Safari 2.0.4
+
+        * kjs/DateMath.h: Marked GregorianDateTime as noncopyable, since it has a non-trivial
+        destructor and not the correspoding copy constructor or assignment operator.
+        Changed the GregorianDateTime constructor to use member initialization syntax.
+        Fixed the destructor to use the array delete operator, since timeZone is an array.
+
+        * kjs/DateMath.cpp:
+        (KJS::daysInYear): Changed to call isLeapYear so the rule is not repeated twice.
+        (KJS::getUTCOffset): Added caching on PLATFORM(DARWIN), since we can rely on the
+        notify_check function and &quot;com.apple.system.timezone&quot; to let us know when the
+        offset has changed.
+
</ins><span class="cx"> 2007-02-27  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Adler.
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsDateMathcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/DateMath.cpp (19942 => 19943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/DateMath.cpp        2007-03-02 09:39:34 UTC (rev 19942)
+++ trunk/JavaScriptCore/kjs/DateMath.cpp        2007-03-02 17:42:20 UTC (rev 19943)
</span><span class="lines">@@ -44,8 +44,11 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;math.h&gt;
</span><span class="cx"> #include &lt;stdint.h&gt;
</span><del>-#include &lt;wtf/OwnPtr.h&gt;
</del><span class="cx"> 
</span><ins>+#if PLATFORM(DARWIN)
+#include &lt;notify.h&gt;
+#endif
+
</ins><span class="cx"> namespace KJS {
</span><span class="cx"> 
</span><span class="cx"> /* Constants */
</span><span class="lines">@@ -56,28 +59,31 @@
</span><span class="cx"> 
</span><span class="cx"> static const double usecPerSec = 1000000.0;
</span><span class="cx"> 
</span><del>-static const double maxUnixTime = 2145859200.0; /*equivalent to 12/31/2037 */
</del><ins>+static const double maxUnixTime = 2145859200.0; // 12/31/2037
</ins><span class="cx"> 
</span><del>-/*
- * The following array contains the day of year for the first day of
- * each month, where index 0 is January, and day 0 is January 1.
- */
-static int firstDayOfMonth[2][12] = {
</del><ins>+// 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.
+static const int firstDayOfMonth[2][12] = {
</ins><span class="cx">     {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
</span><span class="cx">     {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static inline int daysInYear(int year)
</del><ins>+static inline bool isLeapYear(int year)
</ins><span class="cx"> {
</span><span class="cx">     if (year % 4 != 0)
</span><del>-        return 365;
</del><ins>+        return false;
</ins><span class="cx">     if (year % 400 == 0)
</span><del>-        return 366;
</del><ins>+        return true;
</ins><span class="cx">     if (year % 100 == 0)
</span><del>-        return 365;
-    return 366;
</del><ins>+        return false;
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline int daysInYear(int year)
+{
+    return 365 + isLeapYear(year);
+}
+
</ins><span class="cx"> static inline double daysFrom1970ToYear(int year)
</span><span class="cx"> {
</span><span class="cx">     return 365.0 * (year - 1970)
</span><span class="lines">@@ -98,9 +104,8 @@
</span><span class="cx"> 
</span><span class="cx"> static inline int msToYear(double ms)
</span><span class="cx"> {
</span><del>-    int y = static_cast&lt;int&gt;(floor(ms /(msPerDay*365.2425)) + 1970);
</del><ins>+    int y = static_cast&lt;int&gt;(floor(ms / (msPerDay * 365.2425)) + 1970);
</ins><span class="cx">     double t2 = msFrom1970ToYear(y);
</span><del>-
</del><span class="cx">     if (t2 &gt; ms) {
</span><span class="cx">         y--;
</span><span class="cx">     } else {
</span><span class="lines">@@ -110,17 +115,6 @@
</span><span class="cx">     return y;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool isLeapYear(int year)
-{
-    if (year % 4 != 0)
-        return false;
-    if (year % 400 == 0)
-        return true;
-    if (year % 100 == 0)
-        return false;
-    return true;
-}
-
</del><span class="cx"> static inline bool isInLeapYear(double ms)
</span><span class="cx"> {
</span><span class="cx">     return isLeapYear(msToYear(ms));
</span><span class="lines">@@ -133,8 +127,7 @@
</span><span class="cx"> 
</span><span class="cx"> static inline double msToMilliseconds(double ms)
</span><span class="cx"> {
</span><del>-    double result;
-    result = fmod(ms, msPerDay);
</del><ins>+    double result = fmod(ms, msPerDay);
</ins><span class="cx">     if (result &lt; 0)
</span><span class="cx">         result += msPerDay;
</span><span class="cx">     return result;
</span><span class="lines">@@ -143,7 +136,7 @@
</span><span class="cx"> // 0: Sunday, 1: Monday, etc.
</span><span class="cx"> static inline int msToWeekDay(double ms)
</span><span class="cx"> {
</span><del>-    int wd = ((int)msToDays(ms) + 4) % 7;
</del><ins>+    int wd = (static_cast&lt;int&gt;(msToDays(ms)) + 4) % 7;
</ins><span class="cx">     if (wd &lt; 0)
</span><span class="cx">         wd += 7;
</span><span class="cx">     return wd;
</span><span class="lines">@@ -151,33 +144,33 @@
</span><span class="cx"> 
</span><span class="cx"> static inline int msToSeconds(double ms)
</span><span class="cx"> {
</span><del>-    int result = (int) fmod(floor(ms / msPerSecond), secondsPerMinute);
</del><ins>+    double result = fmod(floor(ms / msPerSecond), secondsPerMinute);
</ins><span class="cx">     if (result &lt; 0)
</span><del>-        result += (int)secondsPerMinute;
-    return result;
</del><ins>+        result += secondsPerMinute;
+    return static_cast&lt;int&gt;(result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline int msToMinutes(double ms)
</span><span class="cx"> {
</span><del>-    int result = (int) fmod(floor(ms / msPerMinute), minutesPerHour);
</del><ins>+    double result = fmod(floor(ms / msPerMinute), minutesPerHour);
</ins><span class="cx">     if (result &lt; 0)
</span><del>-        result += (int)minutesPerHour;
-    return result;
</del><ins>+        result += minutesPerHour;
+    return static_cast&lt;int&gt;(result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline int msToHours(double ms)
</span><span class="cx"> {
</span><del>-    int result = (int) fmod(floor(ms/msPerHour), hoursPerDay);
</del><ins>+    double result = fmod(floor(ms/msPerHour), hoursPerDay);
</ins><span class="cx">     if (result &lt; 0)
</span><del>-        result += (int)hoursPerDay;
-    return result;
</del><ins>+        result += hoursPerDay;
+    return static_cast&lt;int&gt;(result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline int msToMonth(double ms)
</span><span class="cx"> {
</span><del>-    int d, step;
</del><ins>+    int step;
</ins><span class="cx">     int year = msToYear(ms);
</span><del>-    d = dayInYear(ms, year);
</del><ins>+    int d = dayInYear(ms, year);
</ins><span class="cx"> 
</span><span class="cx">     if (d &lt; (step = 31))
</span><span class="cx">         return 0;
</span><span class="lines">@@ -207,9 +200,9 @@
</span><span class="cx"> 
</span><span class="cx"> static inline int msToDayInMonth(double ms)
</span><span class="cx"> {
</span><del>-    int d, step, next;
</del><ins>+    int step, next;
</ins><span class="cx">     int year = msToYear(ms);
</span><del>-    d = dayInYear(ms, year);
</del><ins>+    int d = dayInYear(ms, year);
</ins><span class="cx"> 
</span><span class="cx">     if (d &lt;= (next = 30))
</span><span class="cx">         return d + 1;
</span><span class="lines">@@ -293,7 +286,32 @@
</span><span class="cx">  * Get the difference in milliseconds between this time zone and UTC (GMT)
</span><span class="cx">  * NOT including DST.
</span><span class="cx">  */
</span><del>-double getUTCOffset() {
</del><ins>+double getUTCOffset()
+{
+#if PLATFORM(DARWIN)
+    // Register for a notification whenever the time zone changes.
+    static bool triedToRegister = false;
+    static bool haveNotificationToken = false;
+    static int notificationToken;
+    if (!triedToRegister) {
+        triedToRegister = true;
+        uint32_t status = notify_register_check(&quot;com.apple.system.timezone&quot;, &amp;notificationToken);
+        if (status == NOTIFY_STATUS_OK)
+            haveNotificationToken = true;
+    }
+
+    // If we can verify that we have not received a time zone notification,
+    // then use the cached offset from the last time this function was called.
+    static bool haveCachedOffset = false;
+    static double cachedOffset;
+    if (haveNotificationToken &amp;&amp; haveCachedOffset) {
+        int notified;
+        uint32_t status = notify_check(notificationToken, &amp;notified);
+        if (status == NOTIFY_STATUS_OK &amp;&amp; !notified)
+            return cachedOffset;
+    }
+#endif
+
</ins><span class="cx">     tm localt;
</span><span class="cx"> 
</span><span class="cx">     memset(&amp;localt, 0, sizeof(localt));
</span><span class="lines">@@ -305,6 +323,11 @@
</span><span class="cx"> 
</span><span class="cx">     utcOffset *= msPerSecond;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(DARWIN)
+    haveCachedOffset = true;
+    cachedOffset = utcOffset;
+#endif
+
</ins><span class="cx">     return utcOffset;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -315,13 +338,13 @@
</span><span class="cx">  */
</span><span class="cx"> static double getDSTOffsetSimple(double localTimeSeconds)
</span><span class="cx"> {
</span><del>-    if(localTimeSeconds &gt; maxUnixTime)
</del><ins>+    if (localTimeSeconds &gt; maxUnixTime)
</ins><span class="cx">         localTimeSeconds = maxUnixTime;
</span><span class="cx">     else if(localTimeSeconds &lt; 0) // Go ahead a day to make localtime work (does not work with 0)
</span><span class="cx">         localTimeSeconds += secondsPerDay;
</span><span class="cx"> 
</span><span class="cx">     //input is UTC so we have to shift back to local time to determine DST thus the + getUTCOffset()
</span><del>-    double offsetTime = (localTimeSeconds * msPerSecond) + getUTCOffset() ;
</del><ins>+    double offsetTime = (localTimeSeconds * msPerSecond) + getUTCOffset();
</ins><span class="cx"> 
</span><span class="cx">     // Offset from UTC but doesn't include DST obviously
</span><span class="cx">     int offsetHour =  msToHours(offsetTime);
</span><span class="lines">@@ -331,12 +354,12 @@
</span><span class="cx">     time_t localTime = static_cast&lt;time_t&gt;(localTimeSeconds);
</span><span class="cx"> 
</span><span class="cx">     tm localTM;
</span><del>-    #if PLATFORM(WIN_OS)
</del><ins>+#if PLATFORM(WIN_OS)
</ins><span class="cx">     localtime_s(&amp;localTM, &amp;localTime);
</span><del>-    #else
</del><ins>+#else
</ins><span class="cx">     localtime_r(&amp;localTime, &amp;localTM);
</span><del>-    #endif
-    
</del><ins>+#endif
+
</ins><span class="cx">     double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);
</span><span class="cx"> 
</span><span class="cx">     if(diff &lt; 0)
</span><span class="lines">@@ -345,23 +368,19 @@
</span><span class="cx">     return (diff * msPerSecond);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Get the DST offset the time passed in
-// ms is in UTC
</del><ins>+// Get the DST offset, given a time in UTC
</ins><span class="cx"> static double getDSTOffset(double ms)
</span><span class="cx"> {
</span><del>-    // On mac the call to localtime (see getDSTOffsetSimple) will return historically accurate
</del><ins>+    // On Mac OS X, the call to localtime (see getDSTOffsetSimple) will return historically accurate
</ins><span class="cx">     // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript
</span><span class="cx">     // standard explicitly dictates that historical information should not be considered when
</span><del>-    // determining DST.  For this reason we shift years that localtime can handle but would
</del><ins>+    // determining DST. For this reason we shift away from years that localtime can handle but would
</ins><span class="cx">     // return historically accurate information.
</span><span class="cx"> 
</span><span class="cx">     // if before Jan 01, 2000 12:00:00 AM UTC or after Jan 01, 2038 12:00:00 AM UTC
</span><span class="cx">     if (ms &lt; 946684800000.0 || ms &gt; 2145916800000.0) {
</span><del>-        int year;
-        int day;
-
-        year = equivalentYearForDST(msToYear(ms));
-        day = dateToDayInYear(year, msToMonth(ms), msToDayInMonth(ms));
</del><ins>+        int year = equivalentYearForDST(msToYear(ms));
+        int day = dateToDayInYear(year, msToMonth(ms), msToDayInMonth(ms));
</ins><span class="cx">         ms = (day * msPerDay) + msToMilliseconds(ms);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -370,12 +389,11 @@
</span><span class="cx"> 
</span><span class="cx"> double gregorianDateTimeToMS(const GregorianDateTime&amp; t, double milliSeconds, bool inputIsUTC)
</span><span class="cx"> {
</span><del>-
</del><span class="cx">     int day = dateToDayInYear(t.year + 1900, t.month, t.monthDay);
</span><span class="cx">     double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds);
</span><span class="cx">     double result = (day * msPerDay) + ms;
</span><span class="cx"> 
</span><del>-    if(!inputIsUTC) { // convert to UTC
</del><ins>+    if (!inputIsUTC) { // convert to UTC
</ins><span class="cx">         result -= getUTCOffset();       
</span><span class="cx">         result -= getDSTOffset(result);
</span><span class="cx">     }
</span><span class="lines">@@ -388,7 +406,7 @@
</span><span class="cx">     // input is UTC
</span><span class="cx">     double dstOff = 0.0;
</span><span class="cx">     
</span><del>-    if(!outputIsUTC) {  // convert to local time
</del><ins>+    if (!outputIsUTC) {  // convert to local time
</ins><span class="cx">         dstOff = getDSTOffset(ms);
</span><span class="cx">         ms += dstOff + getUTCOffset();
</span><span class="cx">     }
</span><span class="lines">@@ -401,10 +419,10 @@
</span><span class="cx">     tm.yearDay  =  dayInYear(ms, msToYear(ms));
</span><span class="cx">     tm.month    =  msToMonth(ms);
</span><span class="cx">     tm.year     =  msToYear(ms) - 1900;
</span><del>-    tm.isDST =  dstOff != 0.0;
</del><ins>+    tm.isDST    =  dstOff != 0.0;
</ins><span class="cx"> 
</span><span class="cx">     tm.utcOffset = static_cast&lt;long&gt;((dstOff + getUTCOffset()) / msPerSecond);
</span><span class="cx">     tm.timeZone = NULL;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-}   // namespace KJS
</del><ins>+} // namespace KJS
</ins></span></pre></div>
<a id="trunkJavaScriptCorekjsDateMathh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/DateMath.h (19942 => 19943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/DateMath.h        2007-03-02 09:39:34 UTC (rev 19942)
+++ trunk/JavaScriptCore/kjs/DateMath.h        2007-03-02 17:42:20 UTC (rev 19943)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
</span><del>- * Copyright (C) 2006 Apple Computer
</del><ins>+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
</span><span class="cx">  *
</span><span class="lines">@@ -43,10 +43,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;time.h&gt;
</span><span class="cx"> #include &lt;string.h&gt;
</span><ins>+#include &lt;wtf/Noncopyable.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace KJS {
</span><span class="cx"> 
</span><del>-// Constants //
</del><span class="cx"> const char * const weekdayName[7] = { &quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot; };
</span><span class="cx"> const char * const monthName[12] = { &quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot; };
</span><span class="cx"> 
</span><span class="lines">@@ -59,38 +59,27 @@
</span><span class="cx"> const double msPerHour = 60.0 * 60.0 * 1000.0;
</span><span class="cx"> const double msPerDay = 24.0 * 60.0 * 60.0 * 1000.0;
</span><span class="cx"> 
</span><del>-
-// Forward //
-struct GregorianDateTime;
-
-// Exported Functions //
-void msToGregorianDateTime(double, bool outputIsUTC, struct GregorianDateTime&amp;);
-double gregorianDateTimeToMS(const GregorianDateTime&amp;, double, bool inputIsUTC);
-double getUTCOffset();
-int equivalentYearForDST(int year);
-
</del><span class="cx"> // Intentionally overridding the default tm of the system
</span><span class="cx"> // Not all OS' have the same members of their tm's
</span><del>-struct GregorianDateTime {
</del><ins>+struct GregorianDateTime : Noncopyable{
</ins><span class="cx">     GregorianDateTime()
</span><ins>+        : second(0)
+        , minute(0)
+        , hour(0)
+        , weekDay(0)
+        , monthDay(0)
+        , yearDay(0)
+        , month(0)
+        , year(0)
+        , isDST(0)
+        , utcOffset(0)
+        , timeZone(0)
</ins><span class="cx">     {
</span><del>-        second = 0;
-        minute = 0;
-        hour = 0;
-        weekDay = 0;
-        monthDay = 0;
-        yearDay = 0;
-        month = 0;
-        year = 0;
-        isDST = 0;
-        utcOffset = 0;
-        timeZone = NULL;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~GregorianDateTime()
</span><span class="cx">     {
</span><del>-        if (timeZone) 
-            delete timeZone;
</del><ins>+        delete [] timeZone;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     GregorianDateTime(const tm&amp; inTm)
</span><span class="lines">@@ -147,11 +136,16 @@
</span><span class="cx">     int yearDay;
</span><span class="cx">     int month;
</span><span class="cx">     int year;
</span><del>-    int  isDST;
</del><ins>+    int isDST;
</ins><span class="cx">     int utcOffset;
</span><span class="cx">     char* timeZone;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+void msToGregorianDateTime(double, bool outputIsUTC, struct GregorianDateTime&amp;);
+double gregorianDateTimeToMS(const GregorianDateTime&amp;, double, bool inputIsUTC);
+double getUTCOffset();
+int equivalentYearForDST(int year);
+
</ins><span class="cx"> }   //namespace KJS
</span><span class="cx"> 
</span><span class="cx"> #endif // DateMath_h
</span></span></pre>
</div>
</div>

</body>
</html>