returns the offest from the ntp server to local system

@return
@throws IOException
323025
public long getOffset() throws IOException {
	/// Send request
	DatagramSocket socket = null;
	try {
	    socket = new DatagramSocket();
	    socket.setSoTimeout(20000);
	    InetAddress address = InetAddress.getByName(serverName);
	    byte[] buf = new NtpMessage().toByteArray();
	    DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 123);

	    // Set the transmit timestamp *just* before sending the packet
	    NtpMessage.encodeTimestamp(packet.getData(), 40, (System.currentTimeMillis() / 1000.0) + 2208988800.0);

	    socket.send(packet);

	    // Get response
	    packet = new DatagramPacket(buf, buf.length);
	    socket.receive(packet);

	    // Immediately record the incoming timestamp
	    double destinationTimestamp = (System.currentTimeMillis() / 1000.0) + 2208988800.0;

	    // Process response
	    NtpMessage msg = new NtpMessage(packet.getData());
	    // double roundTripDelay = (destinationTimestamp-msg.originateTimestamp) -
	    // (msg.receiveTimestamp-msg.transmitTimestamp);
	    double localClockOffset = ((msg.receiveTimestamp - msg.originateTimestamp) + (msg.transmitTimestamp - destinationTimestamp)) / 2;

	    return (long) (localClockOffset * 1000);
	}
	finally {
	    IOUtil.closeEL(socket);
	}
    }
878376
public boolean ping() throws IOException {
    try (Socket s = new Socket(hostName,port); OutputStream outs = s.getOutputStream()) {
      s.setSoTimeout(timeout);
      outs.write(asBytes("zPING\0"));
      outs.flush();
      byte[] b = new byte[PONG_REPLY_LEN];
      InputStream inputStream = s.getInputStream();
      int copyIndex = 0;
      int readResult;
      do {
        readResult = inputStream.read(b, copyIndex, Math.max(b.length - copyIndex, 0));
        copyIndex += readResult;
      } while (readResult > 0);
      return Arrays.equals(b, asBytes("PONG"));
    }
  }
400092
public long
getTTL() throws IOException {
	String next = _getIdentifier("a TTL value");
	try {
		return TTL.parseTTL(next);
	}
	catch (NumberFormatException e) {
		throw exception("expected a TTL value");
	}
}
1039757
private int get() throws IOException {
        int c = theLookahead;
        theLookahead = EOF;
        if (c == EOF) {
            c = inputStream.read();
        }
        if (c >= ' ' || c == '\n' || c == EOF) {
            return c;
        }
        if (c == '\r') {
            return '\n';
        }
        return ' ';
    }
347104
private static int getOpenPort() throws IOException {
        Log.info(c, "getOpenPort", "Entry.");
        ServerSocket s = new ServerSocket(0);
        Log.info(c, "getOpenPort", "Got socket.");
        int port = s.getLocalPort();
        Log.info(c, "getOpenPort", "Got port " + s);
        s.close();
        Log.info(c, "getOpenPort", "Close socket");
        return port;
    }
2203
public int getDataTransferProtocolVersion() throws IOException {
    synchronized (dataTransferVersion) {
      if (dataTransferVersion == -1) {
        // Get the version number from NN
        try {
          int remoteDataTransferVersion = namenode.getDataTransferProtocolVersion();
          updateDataTransferProtocolVersionIfNeeded(remoteDataTransferVersion);
        } catch (RemoteException re) {
          IOException ioe = re.unwrapRemoteException(IOException.class);
          if (ioe.getMessage().startsWith(IOException.class.getName() + ": " +
              NoSuchMethodException.class.getName())) {
            dataTransferVersion = 14; // last version not supportting this RPC
          } else {
            throw ioe;
          }
        }
        if (LOG.isDebugEnabled()) {
		LOG.debug("Data Transfer Protocal Version is "+ dataTransferVersion);
        }
      }
      return dataTransferVersion;
    }
  }
72998
public long getUInt32() throws IOException
    {
        if (_isMotorolaByteOrder) {
            // Motorola - MSB first (big endian)
            return (((long)getByte()) << 24 & 0xFF000000L) |
                   (((long)getByte()) << 16 & 0xFF0000L) |
                   (((long)getByte()) << 8  & 0xFF00L) |
                   (((long)getByte())       & 0xFFL);
        } else {
            // Intel ordering - LSB first (little endian)
            return (((long)getByte())       & 0xFFL) |
                   (((long)getByte()) << 8  & 0xFF00L) |
                   (((long)getByte()) << 16 & 0xFF0000L) |
                   (((long)getByte()) << 24 & 0xFF000000L);
        }
    }
414745
protected InputStream getInputStream()
        throws IOException
    {
        if (is == null && server != null)
            is = server.readChannel(channel);

        return is;
    }
1077263
public static ntpstatus get(nitro_service service) throws Exception{
		ntpstatus obj = new ntpstatus();
		ntpstatus[] response = (ntpstatus[])obj.get_resources(service);
		return response[0];
	}
1082959
@Override
  public InetSocketAddress ipLocal()
  {
    Socket s = getSocket();
    
    if (s != null) {
      return (InetSocketAddress) s.getLocalSocketAddress();
    }
    else {
      return null;
    }
  }
77570
public String getRawTimestamp() throws IOException {

        final NetTimeConfiguration config = this.getNetTimeConfiguration();

        String address = config.getTimeServerAddress();
        int port = config.getTimeServerPort();
        int timeout = config.getConnectionTimeout();

        return getDaytimeReply(address, port, timeout);

    }
1149969
public int read() throws IOException {
        if (position == size) {
            return -1; // EOF
        }
        if (position < buffer.length) {
            // Convert to unsigned int.
            int c = buffer[(int) position] & 0xFF;
            position++;
            return c;
        }
        int c = diskStream.read();
        if (c >= 0) {
            position++;
        }
        return c;
    }
59331
public String receiveString() throws IOException {
    int len = pgInput.scanCStringLength();
    String res = encoding.decode(pgInput.getBuffer(), pgInput.getIndex(), len - 1);
    pgInput.skip(len);
    return res;
  }
1080700
public byte []
toWire() {
	DNSOutput out = new DNSOutput();
	toWire(out);
	size = out.current();
	return out.toByteArray();
}
821858
protected OutputStream getOutputStream()
        throws IOException
    {
        if (os == null && server != null)
            os = server.writeChannel(channel);

        return os;
    }
574787
int getShort(final long off) throws IOException, InterruptedException {
        if (off < 0 || off > zipFileSlice.len - 2) {
            throw new IndexOutOfBoundsException();
        }
        if (read(off, scratch, 0, 2) < 2) {
            throw new EOFException("Unexpected EOF");
        }
        return ((scratch[1] & 0xff) << 8) | (scratch[0] & 0xff);
    }
608408
public static String getLocalHostPort() {
        String defaultPort = SystemPropertiesUtils.getSystemProperty(
                NaviCommonConstant.SYSTEM_PROPERTY_SERVER_PORT_FROM_SLASH_D_4JPAAS1,
                NaviCommonConstant.SYSTEM_PROPERTY_SERVER_PORT_FROM_ENV_4JPAAS1, ""
                        + RpcServerConf.SERVER_PORT);
        return SystemPropertiesUtils.getSystemProperty(
                NaviCommonConstant.SYSTEM_PROPERTY_SERVER_PORT_FROM_ENV_4JPAAS2, defaultPort);
    }