Changeset 48202 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Sep 9, 2009, 12:02:24 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/DatePrototype.cpp
r47780 r48202 464 464 GregorianDateTime t; 465 465 thisDateObj->msToGregorianDateTime(milli, utc, t); 466 // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) 467 // 6 for formatting and one for null termination = 2 3. We add one extra character to allow us to force null termination.468 char buffer[2 4];469 snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d Z", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second);466 // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds) 467 // 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination. 468 char buffer[28]; 469 snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second, static_cast<int>(fmod(milli, 1000))); 470 470 buffer[sizeof(buffer) - 1] = 0; 471 471 return jsNontrivialString(exec, buffer);
Note:
See TracChangeset
for help on using the changeset viewer.