public void formatValue(StringBuffer toAppendTo, Object value) {double elapsed = ((Number) value).doubleValue();if (elapsed < 0) {toAppendTo.append('-');elapsed = -elapsed;}Object[] parts = new Long[specs.size()];for (int i = 0; i < specs.size(); i++) {parts[i] = specs.get(i).valueFor(elapsed);}try (Formatter formatter = new Formatter(toAppendTo, Locale.ROOT)) {formatter.format(printfFmt, parts);}}

public override void FormatValue(StringBuilder toAppendTo, Object value){double elapsed = ((double)value);if (elapsed < 0){toAppendTo.Append('-');elapsed = -elapsed;}long[] parts = new long[specs.Count];for (int i = 0; i < specs.Count; i++){parts[i] = specs[(i)].ValueFor(elapsed);}string[] fmtPart = printfFmt.Split(":. []".ToCharArray());string split = string.Empty;int pos = 0;int index = 0;Regex regFmt = new Regex("D\\d+");foreach (string fmt in fmtPart){pos += fmt.Length;if (pos < printfFmt.Length){split = printfFmt[pos].ToString();pos++;}elsesplit = string.Empty;if (regFmt.IsMatch(fmt)){toAppendTo.Append(parts[index].ToString(fmt)).Append(split);index++;}else{toAppendTo.Append(fmt).Append(split);}}}
