package art.servers.gost.access.types.neural; import art.servers.Shared; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; @JsonPropertyOrder ({ "Timestamp epoch", "Timestamp UTC", "Timestamp locale" }) public class NeuralStatusTimestamp { @JsonProperty("Timestamp epoch") public long timestampEpoch = 0; @JsonProperty("Timestamp UTC") public String timestampUTC = null; @JsonProperty("Timestamp locale") public String timestampLocale = null; public NeuralStatusTimestamp() { } public NeuralStatusTimestamp(long timestamp) { setTimestamp(timestamp); } @JsonIgnore public void setTimestamp(long timestamp) { SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); SimpleDateFormat LOCALEDATEFORMAT = new SimpleDateFormat(Shared.getMessage("dd/MM/yyyy HH:mm:ss.SSS")); ISO8601DATEFORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); LOCALEDATEFORMAT.setTimeZone(TimeZone.getDefault()); this.timestampEpoch = timestamp; this.timestampUTC = ISO8601DATEFORMAT.format(new Date(timestamp)); this.timestampLocale = LOCALEDATEFORMAT.format(timestamp); } }