[webkit-changes] cvs commit: JavaScriptCore/kjs date_object.cpp

Eric eseidel at opensource.apple.com
Tue Nov 29 02:33:23 PST 2005


eseidel     05/11/29 02:33:23

  Modified:    .        ChangeLog
               kjs      date_object.cpp
  Log:
  Bug #: 5514
  Submitted by: mitz
  Reviewed by: ggaren
          Date conversion to local time gets the DST flag wrong sometimes
          http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
  
          * kjs/date_object.cpp:
          (KJS::isTime_tSigned):
          (KJS::DateProtoFuncImp::callAsFunction):
  
  Revision  Changes    Path
  1.886     +11 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.885
  retrieving revision 1.886
  diff -u -r1.885 -r1.886
  --- ChangeLog	27 Nov 2005 07:54:38 -0000	1.885
  +++ ChangeLog	29 Nov 2005 10:33:19 -0000	1.886
  @@ -1,3 +1,14 @@
  +2005-11-29  Mitz Pettel  <opendarwin.org at mitzpettel.com>
  +
  +        Reviewed by ggaren.  Committed by eseidel.
  +
  +        Date conversion to local time gets the DST flag wrong sometimes
  +        http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
  +
  +        * kjs/date_object.cpp:
  +        (KJS::isTime_tSigned):
  +        (KJS::DateProtoFuncImp::callAsFunction):
  +
   2005-11-26  Maciej Stachowiak  <mjs at apple.com>
   
           Rubber stamped by Eric.
  
  
  
  1.63      +10 -1     JavaScriptCore/kjs/date_object.cpp
  
  Index: date_object.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/date_object.cpp,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- date_object.cpp	24 Oct 2005 20:45:59 -0000	1.62
  +++ date_object.cpp	29 Nov 2005 10:33:22 -0000	1.63
  @@ -469,6 +469,12 @@
       return true;
   }
   
  +static bool isTime_tSigned()
  +{
  +    time_t minusOne = (time_t)(-1);
  +    return minusOne < 0;
  +}
  +
   ValueImp *DateProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
   {
     if ((id == ToString || id == ValueOf || id == GetTime || id == SetTime) &&
  @@ -522,11 +528,14 @@
     
     // check whether time value is outside time_t's usual range
     // make the necessary transformations if necessary
  +  static bool time_tIsSigned = isTime_tSigned();
  +  static double time_tMin = (time_tIsSigned ? - (double)(1ULL << (8 * sizeof(time_t) - 1)) : 0);
  +  static double time_tMax = (time_tIsSigned ? (1ULL << 8 * sizeof(time_t) - 1) - 1 : 2 * (double)(1ULL << 8 * sizeof(time_t) - 1) - 1);
     int realYearOffset = 0;
     double milliOffset = 0.0;
     double secs = floor(milli / msPerSecond);
   
  -  if (milli < 0 || milli >= timeFromYear(2038)) {
  +  if (secs < time_tMin || secs > time_tMax) {
       // ### ugly and probably not very precise
       int realYear = yearFromTime(milli);
       int base = daysInYear(realYear) == 365 ? 2001 : 2000;
  
  
  



More information about the webkit-changes mailing list