Changeset 19945 in webkit for trunk/JavaScriptCore/kjs/date_object.cpp
- Timestamp:
- Mar 2, 2007, 11:55:21 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/date_object.cpp
r18658 r19945 159 159 enum LocaleDateTimeFormat { LocaleDateAndTime, LocaleDate, LocaleTime }; 160 160 161 static JSCell* formatLocaleDate( GregorianDateTimegdt, const LocaleDateTimeFormat format)161 static JSCell* formatLocaleDate(const GregorianDateTime& gdt, const LocaleDateTimeFormat format) 162 162 { 163 163 static const char* formatStrings[] = {"%#c", "%#x", "%X"}; … … 165 165 // Offset year if needed 166 166 struct tm localTM = gdt; 167 gdt.year +=1900;168 bool yearNeedsOffset = gdt.year < 1900 || gdt.year > 2038;167 int year = gdt.year + 1900; 168 bool yearNeedsOffset = year < 1900 || year > 2038; 169 169 if (yearNeedsOffset) { 170 localTM.tm_year = equivalentYearForDST( gdt.year) - 1900;170 localTM.tm_year = equivalentYearForDST(year) - 1900; 171 171 } 172 172 … … 186 186 snprintf(yearString, yearLen, "%d", localTM.tm_year + 1900); 187 187 char* yearLocation = strstr(timebuffer, yearString); 188 snprintf(yearString, yearLen, "%d", gdt.year);188 snprintf(yearString, yearLen, "%d", year); 189 189 190 190 strncpy(yearLocation, yearString, yearLen - 1);
Note:
See TracChangeset
for help on using the changeset viewer.