@Benchmark public StringBuilder append() { builder.setLength(0); FIXTimestamps.append(timestamp, builder); return builder; }
/** * Append a timestamp to a string builder. * * @param t a timestamp * @param s a string builder */ public static void append(ReadableDateTime t, StringBuilder s) { s.append(t.getYear()); appendTwoDigits(t.getMonthOfYear(), s); appendTwoDigits(t.getDayOfMonth(), s); s.append('-'); appendTwoDigits(t.getHourOfDay(), s); s.append(':'); appendTwoDigits(t.getMinuteOfHour(), s); s.append(':'); appendTwoDigits(t.getSecondOfMinute(), s); s.append('.'); appendThreeDigits(t.getMillisOfSecond(), s); }
/** * Append a timestamp to a string builder. * * @param t a timestamp * @param s a string builder */ public static void append(ReadableDateTime t, StringBuilder s) { char[] buffer = BUFFER.get(); setDigits(buffer, t.getYear(), 0, 4); setDigits(buffer, t.getMonthOfYear(), 4, 2); setDigits(buffer, t.getDayOfMonth(), 6, 2); buffer[8] = '-'; setDigits(buffer, t.getHourOfDay(), 9, 2); buffer[11] = ':'; setDigits(buffer, t.getMinuteOfHour(), 12, 2); buffer[14] = ':'; setDigits(buffer, t.getSecondOfMinute(), 15, 2); buffer[17] = '.'; setDigits(buffer, t.getMillisOfSecond(), 18, 3); s.append(buffer); }
/** * <p>Update the current timestamp. The current timestamp is used for the * following purposes:</p> * * <ul> * <li>SendingTime(52)</li> * <li>the connection keep-alive mechanism</li> * </ul> */ public void updateCurrentTimestamp() { currentTimeMillis = clock.currentTimeMillis(); currentTime.setMillis(currentTimeMillis); currentTimestamp.setLength(0); FIXTimestamps.append(currentTime, currentTimestamp); }
/** * <p>Update the current timestamp. The current timestamp is used for the * following purposes:</p> * * <ul> * <li>SendingTime(52)</li> * <li>the connection keep-alive mechanism</li> * </ul> */ public void updateCurrentTimestamp() { currentTimeMillis = clock.currentTimeMillis(); currentTime.setMillis(currentTimeMillis); currentTimestamp.setLength(0); FIXTimestamps.append(currentTime, currentTimestamp); }
FIXTimestamps.append(this.currentTime, this.currentTimestamp);
FIXTimestamps.append(this.currentTime, this.currentTimestamp);