com.ezprotocols.ezclock
Class EzClock

java.lang.Object
  |
  +--com.ezprotocols.ezclock.EzClock
All Implemented Interfaces:
java.io.Serializable

public class EzClock
extends java.lang.Object
implements java.io.Serializable

Queries Time server to get the exact time. EzClock retrieves the time from an atomic clock and can automatically set your system time.

Example:


  try{
     EzClock ezClock = new EzClock();
     SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
     ezClock.setTimeServer("time-b.nist.gov");
     ezClock.setTimePort(37);
     Date currentTime = ezClock.getLocalTime();
     System.out.println("Atomic time : "+sdf.format(currentTime));
 }catch(EzClockException ex){
     System.out.println(ex.getMessage());
 }

See Also:
Serialized Form

Constructor Summary
EzClock()
          Creates a new instance of EzClock.
 
Method Summary
 java.lang.String getAbout()
          Gets Information about EzClock.
 void getAndUpdateSystemTime()
          Queries Time server and updates the system date.
 java.util.Date getGmtTime()
          Queries Time server and returns current GMT time.
 java.util.Date getLocalTime()
          Queries Time server and returns the current time converted to your local timezone.
 java.lang.String getSerialKey()
          Gets the Serial Key used to activate the full version.
 java.util.Date getTime(java.util.TimeZone timeZone)
          Queries Time server and returns the time converted to a specific timezone.
 int getTimeout()
          Gets the Timeout to open the connection with the Time Server.
 int getTimePort()
          Gets the Time server port number.
 java.lang.String getTimeServer()
          Gets the Time server address.
 java.lang.String getVersion()
          Gets the version number of EzClock.
 void setAbout(java.lang.String s)
           
 void setSerialKey(java.lang.String k)
          Sets the Serial Key to activate the full version.
 void setTimeout(int t)
          Sets the Timeout to open the connection with the Time server.
 void setTimePort(int port)
          Sets the Time server port (Default is 37).
 void setTimeServer(java.lang.String s)
          Sets the address of the Time server.
 void setVersion(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EzClock

public EzClock()
Creates a new instance of EzClock.
Method Detail

getLocalTime

public java.util.Date getLocalTime()
                            throws EzClockException
Queries Time server and returns the current time converted to your local timezone.

getTime

public java.util.Date getTime(java.util.TimeZone timeZone)
                       throws EzClockException
Queries Time server and returns the time converted to a specific timezone.

getGmtTime

public java.util.Date getGmtTime()
                          throws EzClockException
Queries Time server and returns current GMT time.

getAndUpdateSystemTime

public void getAndUpdateSystemTime()
                            throws EzClockException
Queries Time server and updates the system date. Supported OS : Windows NT, Windows 2000, Windows XP, Windows 95, Windows 98, Windows Me, Linux, SunOS and Solaris.

setVersion

public void setVersion(java.lang.String s)

setAbout

public void setAbout(java.lang.String s)

setSerialKey

public void setSerialKey(java.lang.String k)
Sets the Serial Key to activate the full version.

setTimeServer

public void setTimeServer(java.lang.String s)
Sets the address of the Time server.

setTimeout

public void setTimeout(int t)
Sets the Timeout to open the connection with the Time server. Default is 0 and implies that the option is disabled (Timeout = infinity).

setTimePort

public void setTimePort(int port)
Sets the Time server port (Default is 37).

getTimeServer

public java.lang.String getTimeServer()
Gets the Time server address.

getTimePort

public int getTimePort()
Gets the Time server port number.

getVersion

public java.lang.String getVersion()
Gets the version number of EzClock.

getAbout

public java.lang.String getAbout()
Gets Information about EzClock.

getSerialKey

public java.lang.String getSerialKey()
Gets the Serial Key used to activate the full version.

getTimeout

public int getTimeout()
Gets the Timeout to open the connection with the Time Server. Default is 0 and implies that the option is disabled (Timeout = infinity).


Copyright © EzProtocols.com All Rights Reserved.