From 0c68eb43910b49669ace45de51aa2a4ea3d6f6f0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 Oct 2017 14:46:43 +0300 Subject: xmpp: Java 8 Time API --- .../src/main/java/com/juick/components/s2s/Connection.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'juick-xmpp/src/main/java/com/juick/components/s2s') diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java b/juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java index 7fd036eb..86f276b4 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java @@ -33,6 +33,7 @@ import java.net.Socket; import java.nio.charset.StandardCharsets; import java.security.*; import java.security.cert.CertificateException; +import java.time.Instant; import java.util.UUID; /** @@ -44,8 +45,8 @@ public class Connection { protected static final Logger logger = LoggerFactory.getLogger(Connection.class); public String streamID; - public long tsCreated = 0; - public long tsLocalData = 0; + public Instant created; + public Instant updated; public long bytesLocal = 0; public long packetsLocal = 0; XMPPServer xmpp; @@ -74,7 +75,7 @@ public class Connection { public Connection(XMPPServer xmpp) throws XmlPullParserException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException, KeyManagementException { this.xmpp = xmpp; - tsCreated = System.currentTimeMillis(); + created = Instant.now(); KeyStore ks = KeyStore.getInstance("JKS"); try (InputStream ksIs = new FileInputStream(xmpp.keystore)) { ks.load(ksIs, xmpp.keystorePassword.toCharArray()); @@ -111,7 +112,7 @@ public class Connection { logger.error("send stanza failed", e); } - tsLocalData = System.currentTimeMillis(); + updated = Instant.now(); bytesLocal += xml.length(); packetsLocal++; } -- cgit v1.2.3