in data/src/main/java/com/microsoft/azure/kusto/data/format/CslTimespanFormat.java [25:53]
public CslTimespanFormat(String value) {
if (StringUtils.isBlank(value)) {
this.value = null;
} else {
Matcher matcher = ClientRequestProperties.KUSTO_TIMESPAN_REGEX.matcher(value);
if (!matcher.matches()) {
throw new ParseException(String.format("Failed to parse timeout string as a timespan. Value: %s", value));
}
long nanos = 0;
String days = matcher.group(2);
if (days != null && !days.equals("0")) {
nanos = TimeUnit.DAYS.toNanos(Integer.parseInt(days));
}
String timespanWithoutDays = "";
for (int i = 4; i <= 10; i++) {
if (matcher.group(i) != null) {
timespanWithoutDays += matcher.group(i);
}
}
nanos += LocalTime.parse(timespanWithoutDays).toNanoOfDay();
if ("-".equals(matcher.group(1))) {
this.value = Duration.ofNanos(nanos).negated();
} else {
this.value = Duration.ofNanos(nanos);
}
}
}