Chromium Code Reviews| Index: src/dateparser.h |
| =================================================================== |
| --- src/dateparser.h (revision 5888) |
| +++ src/dateparser.h (working copy) |
| @@ -87,6 +87,17 @@ |
| return n; |
| } |
| + // Read a string of up to three digits as an unsigned number of milliseconds |
| + int ReadMilliseconds() { |
| + has_read_number_ = true; |
| + int n = 0; |
| + int i; |
| + for (i = 0; IsAsciiDigit(); Next(), i++) { |
| + if (i < 3) n = n + pow(10, 2 - i) * (ch_ - '0'); |
|
Lasse Reichstein
2010/11/25 12:56:05
I'm somewhat opposed to using the standard pow(dou
Florian Loitsch
2010/11/25 13:55:54
Isn't this simply:
for (int i = 0; IsAsciiDigit();
Lasse Reichstein
2010/11/25 14:10:36
Not if there are fewer than three digits. We need
|
| + } |
| + return n; |
| + } |
| + |
| // Read a word (sequence of chars. >= 'A'), fill the given buffer with a |
| // lower-case prefix, and pad any remainder of the buffer with zeroes. |
| // Return word length. |