Index: src/dateparser.h |
=================================================================== |
--- src/dateparser.h (revision 4543) |
+++ src/dateparser.h (working copy) |
@@ -44,13 +44,14 @@ |
// [3]: hour |
// [4]: minute |
// [5]: second |
- // [6]: UTC offset in seconds, or null value if no timezone specified |
+ // [6]: millisecond |
+ // [7]: UTC offset in seconds, or null value if no timezone specified |
// If parsing fails, return false (content of output array is not defined). |
template <typename Char> |
static bool Parse(Vector<Char> str, FixedArray* output); |
enum { |
- YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, UTC_OFFSET, OUTPUT_SIZE |
+ YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MILLISECOND, UTC_OFFSET, OUTPUT_SIZE |
}; |
private: |
@@ -189,7 +190,9 @@ |
TimeComposer() : index_(0), hour_offset_(kNone) {} |
bool IsEmpty() const { return index_ == 0; } |
bool IsExpecting(int n) const { |
- return (index_ == 1 && IsMinute(n)) || (index_ == 2 && IsSecond(n)); |
+ return (index_ == 1 && IsMinute(n)) || |
+ (index_ == 2 && IsSecond(n)) || |
+ (index_ == 3 && IsMillisecond(n)); |
} |
bool Add(int n) { |
return index_ < kSize ? (comp_[index_++] = n, true) : false; |
@@ -207,8 +210,9 @@ |
static bool IsHour(int x) { return Between(x, 0, 23); } |
static bool IsHour12(int x) { return Between(x, 0, 12); } |
static bool IsSecond(int x) { return Between(x, 0, 59); } |
+ static bool IsMillisecond(int x) { return Between(x, 0, 999); } |
- static const int kSize = 3; |
+ static const int kSize = 4; |
int comp_[kSize]; |
int index_; |
int hour_offset_; |