Example usage for org.apache.commons.net TimeUDPClient SECONDS_1900_TO_1970

List of usage examples for org.apache.commons.net TimeUDPClient SECONDS_1900_TO_1970

Introduction

In this page you can find the example usage for org.apache.commons.net TimeUDPClient SECONDS_1900_TO_1970.

Prototype

long SECONDS_1900_TO_1970

To view the source code for org.apache.commons.net TimeUDPClient SECONDS_1900_TO_1970.

Click Source Link

Document

The number of seconds between 00:00 1 January 1900 and 00:00 1 January 1970.

Usage

From source file:ProtocolRunner.java

private static void handleUDPTime(
    TimeUDPClient client, ProtocolRunner runner) 
    throws IOException {
            /*  ww w  . j a  v a 2  s.c  o m*/
    long origTime = client.getTime(InetAddress.getByName(
        runner.getUDPRemoteServer()));

    runner.getUDPServerResponse().append(
    "Time returned from server: " +  origTime + "\r\n" +
    "Converted to Date: " + 
    new Date(((origTime) - TimeUDPClient.SECONDS_1900_TO_1970)*1000L));
}