org.mars_sim.msp.core.time
Class EarthClock

java.lang.Object
  extended by org.mars_sim.msp.core.time.EarthClock
All Implemented Interfaces:
Serializable

public class EarthClock
extends Object
implements Serializable

The EarthClock class keeps track of Earth Universal Time. It should be synchronized with the Mars clock.

See Also:
Serialized Form

Constructor Summary
EarthClock(String dateString)
          Constructor
 
Method Summary
 void addTime(double seconds)
          Adds time to the calendar
 String getDateString()
          Returns the date formatted in a string
 int getDayOfMonth()
           
 int getMonth()
           
 String getTimeStamp()
          Returns the date/time formatted in a string
 int getYear()
           
 String toString()
          Displays the string version of the clock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EarthClock

public EarthClock(String dateString)
Constructor

Parameters:
dateString - the UT date string in format: "MM/dd/yyyy hh:mm:ss".
Throws:
Exception - if date string is invalid.
Method Detail

getTimeStamp

public String getTimeStamp()
Returns the date/time formatted in a string

Returns:
date/time formatted in a string. ex "2055-05-06 03:37:22 UT"

getDateString

public String getDateString()
Returns the date formatted in a string

Returns:
date formatted in a string. ex "2055-05-06"

addTime

public void addTime(double seconds)
Adds time to the calendar

Parameters:
seconds - seconds added to the calendar

toString

public String toString()
Displays the string version of the clock.

Overrides:
toString in class Object
Returns:
time stamp string.

getDayOfMonth

public int getDayOfMonth()

getMonth

public int getMonth()

getYear

public int getYear()


Copyright © 2009-2013. All Rights Reserved.