lojix/power_model/src/main/com/thesett/aima/attribute/time/TimeUtils.java
public static ByteBuffer putTimeOnlyAsString(ByteBuffer buffer, long value, boolean includeMilliseconds)
    {
        // Ensure there is sufficient space in the buffer for the date.
        int charsRequired =
            includeMilliseconds ? TIME_ONLY_LENGTH_WITH_MILLISECONDS : TIME_ONLY_LENGTH_WIHTOUT_MILLISECONDS;

        buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToHours(value), 2);
        buffer = ByteBufferUtils.putByteAsString(buffer, (byte) ':');
        buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToMinutes(value), 2);
        buffer = ByteBufferUtils.putByteAsString(buffer, (byte) ':');
        buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToSeconds(value), 2);

        if (includeMilliseconds)
        {
            buffer = ByteBufferUtils.putByteAsString(buffer, (byte) '.');
            buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToMilliseconds(value), 3);
        }

        return buffer;
    }
public static ByteBuffer putTimeOnlyAsString(ByteBuffer buffer, long value, boolean includeMilliseconds)
    {
        // Ensure there is sufficient space in the buffer for the date.
        int charsRequired =
            includeMilliseconds ? TIME_ONLY_LENGTH_WITH_MILLISECONDS : TIME_ONLY_LENGTH_WIHTOUT_MILLISECONDS;

        buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToHours(value), 2);
        buffer = ByteBufferUtils.putByteAsString(buffer, (byte) ':');
        buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToMinutes(value), 2);
        buffer = ByteBufferUtils.putByteAsString(buffer, (byte) ':');
        buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToSeconds(value), 2);

        if (includeMilliseconds)
        {
            buffer = ByteBufferUtils.putByteAsString(buffer, (byte) '.');
            buffer = ByteBufferUtils.putPaddedInt32AsString(buffer, ticksToMilliseconds(value), 3);
        }

        return buffer;
    }
Writes only the time component of a time of day timestamp to a byte array in the following format:
HH:MM:SS[.sss]. The millisecond value is optional and is only written if requested. If there is insufficient
space in the buffer to write the value into, then the buffer size is increased using the supplied byte buffer
pool.

@param  buffer              The byte buffer to write to.
@param  value               The value to write as a millisecond timestamp.
@param  includeMilliseconds <tt>true</tt> to include milliseconds in the output.

@return The byte buffer with the value written to it. This may be a different buffer to the one passed in if the
buffer had to be copied in order to increase its size.