private bool ParseTime(ref int start) {
if (
Parse2Dig(start , ref hour) && hour < 24 &&
ParseChar(start + LzHH, ':') &&
Parse2Dig(start + LzHH_, ref minute) && minute < 60 &&
ParseChar(start + LzHH_mm, ':') &&
Parse2Dig(start + LzHH_mm_, ref second) && second < 60
) {
start += LzHH_mm_ss;
if (ParseChar(start, '.')) {
// Parse factional part of seconds
// We allow any number of digits, but keep only first 7
this.fraction = 0;
int fractionDigits = 0;
int round = 0;
while (++start < length) {
int d = text[start] - '0';
if (9u < (uint) d) { // d < 0 || 9 < d
break;
}
if (fractionDigits < maxFractionDigits) {
this.fraction = (this.fraction * 10) + d;
} else if (fractionDigits == maxFractionDigits) {
if (5 < d) {
round = 1;
} else if (d == 5) {
round = -1;
}
} else if (round < 0 && d != 0) {
round = 1;
}
fractionDigits ++;
}
if (fractionDigits < maxFractionDigits) {
if (fractionDigits == 0) {
return false; // cannot end with .
}
fraction *= Power10[maxFractionDigits - fractionDigits];
} else {
if (round < 0) {
round = fraction & 1;
}
fraction += round;
}
}
return true;
}
// cleanup - conflict with gYear
hour = 0;
return false;
}