Changeset 16783 in webkit for trunk/JavaScriptCore
- Timestamp:
- Oct 4, 2006, 1:35:58 PM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r16782 r16783 6 6 lines so you can see more assertions in less space. Also improved format 7 7 of file/line information so it works with more development environments. 8 9 2006-10-04 Kevin McCullough <[email protected]> 10 11 Reviewed by Tim H. 12 13 - The build machine is more sensitive about automatic conversions. These fixes exp 14 licitly cast or change the input and return types of functions to avoid conversions. 15 16 * JavaScriptCore.xcodeproj/project.pbxproj: 17 * kjs/DateMath.cpp: 18 (KJS::): 19 (KJS::msToDays): 20 (KJS::msToYear): 21 (KJS::dayInYear): 22 (KJS::monthToDayInYear): 23 (KJS::dateToDayInYear): 24 (KJS::getDSTOffsetSimple): 25 (KJS::getDSTOffset): 26 (KJS::dateToMseconds): 27 (KJS::msToTM): 8 28 9 29 2006-10-04 Kevin McCullough <[email protected]> -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r16780 r16783 1794 1794 "-Wundef", 1795 1795 "-Wshorten-64-to-32", 1796 "-Wconversion", 1796 1797 ); 1797 1798 }; … … 1838 1839 "-Wundef", 1839 1840 "-Wshorten-64-to-32", 1841 "-Wconversion", 1840 1842 ); 1841 1843 }; … … 1878 1880 "-Wundef", 1879 1881 "-Wshorten-64-to-32", 1882 "-Wconversion", 1880 1883 ); 1881 1884 }; -
trunk/JavaScriptCore/kjs/DateMath.cpp
r16780 r16783 64 64 * each month, where index 0 is January, and day 0 is January 1. 65 65 */ 66 static doublefirstDayOfMonth[2][12] = {67 {0 .0, 31.0, 59.0, 90.0, 120.0, 151.0, 181.0, 212.0, 243.0, 273.0, 304.0, 334.0},68 {0 .0, 31.0, 60.0, 91.0, 121.0, 152.0, 182.0, 213.0, 244.0, 274.0, 305.0, 335.0}66 static int firstDayOfMonth[2][12] = { 67 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}, 68 {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335} 69 69 }; 70 70 … … 109 109 } 110 110 111 static inline intmsToDays(double ms)111 static inline double msToDays(double ms) 112 112 { 113 113 return floor(ms / msPerDay); 114 114 } 115 115 116 static inline intmsToYear(double ms)117 { 118 inty = floor(ms /(msPerDay*365.2425)) + 1970;116 static inline double msToYear(double ms) 117 { 118 double y = floor(ms /(msPerDay*365.2425)) + 1970; 119 119 double t2 = msFrom1970ToYear(y); 120 120 … … 144 144 } 145 145 146 static inline intdayInYear(double ms, int year)146 static inline double dayInYear(double ms, int year) 147 147 { 148 148 return msToDays(ms) - daysFrom1970ToYear(year); … … 266 266 } 267 267 268 static inline doublemonthToDayInYear(int month, bool isLeapYear)268 static inline int monthToDayInYear(int month, bool isLeapYear) 269 269 { 270 270 return firstDayOfMonth[isLeapYear][month]; … … 276 276 } 277 277 278 static double dateToDayInYear(double year, double month, doubleday)278 static int dateToDayInYear(int year, int month, int day) 279 279 { 280 280 year += floor(month / 12); … … 284 284 month += 12; 285 285 286 double yearday = floor(msFrom1970ToYear(year) / msPerDay);287 doublemonthday = monthToDayInYear(month, isLeapYear(year));286 int yearday = static_cast<int>(floor(msFrom1970ToYear(year) / msPerDay)); 287 int monthday = monthToDayInYear(month, isLeapYear(year)); 288 288 289 289 return yearday + monthday + day - 1; … … 363 363 prtm.tm_hour = msToHours(offsetTime); 364 364 365 366 time_t localTime = localTimeSeconds;365 // FIXME: time_t has a potential problem in 2038 366 time_t localTime = static_cast<time_t>(localTimeSeconds); 367 367 368 368 struct tm tm; … … 390 390 if (ms < 0.0 || ms > 2145916800000.0) { 391 391 int year; 392 doubleday;392 int day; 393 393 394 394 year = equivalentYearForDST(msToYear(ms)); … … 417 417 double dateToMseconds(tm* t, double ms, bool inputIsUTC) 418 418 { 419 doubleday = dateToDayInYear(t->tm_year + 1900, t->tm_mon, t->tm_mday);419 int day = dateToDayInYear(t->tm_year + 1900, t->tm_mon, t->tm_mday); 420 420 double msec_time = timeToMseconds(t->tm_hour, t->tm_min, t->tm_sec, ms); 421 421 double result = (day * msPerDay) + msec_time; … … 446 446 #if !PLATFORM(WIN_OS) 447 447 struct tm xtm; 448 time_t seconds = ms/usecPerMsec; 448 // FIXME: time_t has a potential problem in 2038 449 time_t seconds = static_cast<time_t>(ms/usecPerMsec); 449 450 localtime_r(&seconds, &xtm); 450 451 tm.tm_gmtoff = xtm.tm_gmtoff;
Note:
See TracChangeset
for help on using the changeset viewer.