/* (non-Javadoc)
@see org.graylog2.syslog4j.impl.message.processor.AbstractSyslogMessageProcessor#appendTimestamp(java.lang.StringBuffer, java.util.Date)

This is compatible with RFC5424 protocol.
180860
@Override
    public void appendTimestamp(StringBuffer buffer, Date datetime) {
        SimpleDateFormat formatter = new SimpleDateFormat(SyslogConstants.SYSLOG_DATEFORMAT_RFC5424);
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(datetime.getTime());
        String formatedTimestamp = formatter.format(calendar.getTime());
        buffer.append(formatedTimestamp);	
        buffer.append(' ');
    }
996974
@Override
	public Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
		return wrapped.getTimestamp(columnLabel, cal);
	}
856055
public static String formatTimestamp(@Nullable Date date) {
        return (date != null) ? date.toInstant().toString() : null;
    }
152235
@Override
    public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
1223692
public final void setCurrentMEArrivalTimestamp(long value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setCurrentMEArrivalTimestamp", Long.valueOf(value));
        jmo.setLongField(JsHdrAccess.ARRIVALTIMESTAMP, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setCurrentMEArrivalTimestamp");
    }
183331
private String getFormattedTimestamp(int offset) {
        SimpleDateFormat df = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        df.setTimeZone(TimeZone.getTimeZone("UTC"));

        if (overriddenDate != null) {
            return df.format(overriddenDate);
        } else {
            return df.format(getSignatureDate(offset));
        }
    }
795260
@Override
    public CompletableFuture<Void> append(String streamSegmentName, byte[] data, Collection<AttributeUpdate> attributeUpdates, Duration timeout) {
        return invoke(
                streamSegmentName,
                container -> container.append(streamSegmentName, data, attributeUpdates, timeout),
                "append", streamSegmentName, data.length, attributeUpdates);
    }
387905
protected void createEventTimeStamp(RepositoryLogRecord record, StringBuilder buffer) {
		if (null == record) {
			throw new IllegalArgumentException("Record cannot be null");
		}
		if (null == buffer) {
			throw new IllegalArgumentException("Buffer cannot be null");
		}
		// Create the time stamp
		buffer.append('[');
		Date eventDate = new Date(record.getMillis());
		// set the dateFormat object to the desired timeZone. Allows log output
		// to be presented in different time zones.
		dateFormat.setTimeZone(timeZone); // set the format to
		// the desired
		// time zone.
		buffer.append(dateFormat.format(eventDate));
		buffer.append("] ");
	}
879622
static public TimestampType decodeTimestamp(final ByteBuffer bb) {
        final Long val = bb.getLong();
        return new TimestampType(val);
    }
304876
public static java.sql.Timestamp toSqlTimestamp(java.util.Date date) {
		return new java.sql.Timestamp(date.getTime());
	}
613122
static String getFormattedTimestamp() {
        DateFormat df = dateFormatPool.getAndSet(null);
        if (df == null) {
            df = createISODateFormat();
        }
        String timestamp = df.format(new Date());
        dateFormatPool.set(df);
        return timestamp;
    }
1335621
@Override
    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
    {
        checkParameterBounds(parameterIndex);
        throw SQLError.noSupport();
    }
983996
public static final String printTimestamp(Date value)
   {
      return (value == null ? null : TIMESTAMP_FORMAT.get().format(value));
   }
1015696
public static Timestamp parseTimestamp(String timestamp) {
    TemporalAccessor temporalAccessor = timestampParser.parse(timestamp);
    Instant instant = Instant.from(temporalAccessor);
    return ofTimeSecondsAndNanos(instant.getEpochSecond(), instant.getNano());
  }
472989
public static String getTimestamp(Date time) {
        return getTimestampFormatter().format(time == null ? new Date() : time);
    }
440833
public String getTimestamp() {
        return (data != null && data.payload != null) ? data.payload.timestamp : null;
    }
844626
public static Timestamp toSqlTimestamp(Instant instant) {
        try {
            Timestamp ts = new Timestamp(instant.getEpochSecond() * 1000);
            ts.setNanos(instant.getNano());
            return ts;
        } catch (ArithmeticException ex) {
            throw new IllegalArgumentException(ex);
        }
    }