⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timeprotocolconstants.java

📁 21天学通java的示例程序源代码
💻 JAVA
字号:
// TimeProtocolConstants.java

package com.wrox.timeprotocol;

import java.util.Calendar;

/**
 * Defines constants used by clients and servers implementing the time
 * protocol defined in RFC 868.
 */
public class TimeProtocolConstants {

  /**
   * Prevent instantiation
   */
  private TimeProtocolConstants() {}

  /**
   * The time protocol TCP port defined in RFC 868
   */
  public static final int TCP_PORT = 37;

  /**
   * The number of milliseconds between the RFC 868 epoch, January
   * 1st 1900, 0:0:0 UTC, and the Java epoch, January 1st 1970, 0:0:0 UTC
   */
  public static final long EPOCH_OFFSET_MILLIS;

  /**
   * Computes the epoch offset
   */
  static {
    Calendar calendar = 
      Calendar.getInstance(java.util.TimeZone.getTimeZone("UTC"));
    calendar.set(1900, Calendar.JANUARY, 1, 0, 0, 0);
    EPOCH_OFFSET_MILLIS = Math.abs(calendar.getTime().getTime());
  } 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -