/** * Parses time hh:mm:ss.sss and time zone if any * * @param start * @param end * @param data * @exception RuntimeException */ protected void getTime(String buffer, int start, int end, DateTimeData data) throws RuntimeException { int stop = start + 2; // get hours (hh) data.hour = parseInt(buffer, start, stop); // get minutes (mm) if (buffer.charAt(stop++) != ':') { throw new RuntimeException("Error in parsing time zone"); } start = stop; stop = stop + 2; data.minute = parseInt(buffer, start, stop); // get seconds (ss) if (buffer.charAt(stop++) != ':') { throw new RuntimeException("Error in parsing time zone"); } // find UTC sign if any int sign = findUTCSign(buffer, start, end); // get seconds (ms) start = stop; stop = sign < 0 ? end : sign; data.second = parseSecond(buffer, start, stop); // parse UTC time zone (hh:mm) if (sign > 0) { getTimeZone(buffer, data, sign, end); } }
/** * Shared code from Date and YearMonth datatypes. Finds if time zone sign is present * * @param end * @param date * @exception RuntimeException */ protected void parseTimeZone(String buffer, int start, int end, DateTimeData date) throws RuntimeException { // fStart points right after the date if (start < end) { if (!isNextCharUTCSign(buffer, start, end)) { throw new RuntimeException("Error in month parsing"); } else { getTimeZone(buffer, date, start, end); } } }