List of usage examples for org.apache.commons.net TimeTCPClient getTime
public long getTime() throws IOException
From source file:ProtocolRunner.java
private static void handleTCPTime( TimeTCPClient client, ProtocolRunner runner) throws IOException { long origTime = client.getTime(); //from w w w . jav a2s . c o m // remember that the long time returned from the server is the // seconds since midnight Jan 1900 and Date in Java is number of // seconds since midnight Jan 1970. NET TCPClient provides the time // in both formats but you cannot call them both one after another // as the internal getDate uses getTime, but the line has already // been closed if you have called getTime before. runner.getTCPServerResponse().append( "Time returned from server: " + origTime + "\r\n" + "Converted to Date: " + new Date(((origTime) - TimeTCPClient.SECONDS_1900_TO_1970)*1000L)); }