EzClock 1.0 Query a time server to get the exact time. EzClock retrieves the time from an atomic clock server and can automatically set your system time.
Price : $20.00


[Try it!] [Buy it!]
[Methods] [Brief Server List] [View Javadoc] [Download Javadoc]
  [Example]

 

Principal methods
Method Name Description
EzClock()
Creates a new instance of EzClock.
getGmtTime() Queries Time server and returns the current GMT time.
getLocalTime() Queries Time server and returns the current time converted toyour local timezone.
getTime(TimeZone timeZone) Queries Time server and returns the time converted to a specific timezone.
getAndUpdateSystemTime() Queries Time server and updates the system date.
Supported OS : Windows, Linux, SunOS and Solaris.
setTimeServer(String server) Sets the address of the Time server.
setTimePort(int port) Sets the Time server port (Default is 37).
setSerialKey(String key) Sets the Serial Key used to activate the full version.
setTimeout(int timeout) Sets the Timeout to open the connection with the Time Server.



Brief list of Time servers
Server Name Location
time-a.nist.gov
NIST, Gaithersburg, Maryland
time-b.nist.gov
NIST, Gaithersburg, Maryland
time-a.timefreq.bldrdoc.gov
NIST, Boulder, Colorado
time-b.timefreq.bldrdoc.gov NIST, Boulder, Colorado
time-c.timefreq.bldrdoc.gov NIST, Boulder, Colorado
utcnist.colorado.edu University of Colorado, Boulder
time.nist.gov NCAR, Boulder, Colorado
time-nw.nist.gov Microsoft, Redmond, Washington
nist1.datum.com Datum, San Jose, California
nist1.dc.glassey.com Abovenet, Virginia
nist1.ny.glassey.com Abovenet, New York City
nist1.sj.glassey.com Abovenet, San Jose, California
nist1.aol-ca.truetime.com TrueTime, AOL facility, Sunnyvale, California
nist1.aol-va.truetime.com TrueTime, AOL facility, Virginia


Example: Clock.java

import com.ezjavabeans.ezclock.*;
import java.util.Date;
import java.text.SimpleDateFormat;

/** EzClock Example : Queries time from a time server
 *  (Atomic clock) and prints it */
public class Clock {
  EzClock ezClock = new EzClock();

  /** Default Constructor */
  public Clock() {
  }


  /** Queries Time server and prints the current time */
  public static void main(String[] args) {
    try{
      Clock clock = new Clock();
      SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
      clock.ezClock.setTimeServer("time-b.nist.gov");
      clock.ezClock.setTimePort(37);
      Date currentTime = clock.ezClock.getLocalTime();
      System.out.println("Atomic time : "+sdf.format(currentTime));
    }catch(EzClockException ex){
      System.out.println(ex.getMessage());
    }
  }

}