org.mars_sim.msp.simulation.time
Class EarthClock

java.lang.Object
  extended by java.util.Calendar
      extended by java.util.GregorianCalendar
          extended by org.mars_sim.msp.simulation.time.EarthClock
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Calendar>

public class EarthClock
extends java.util.GregorianCalendar
implements java.io.Serializable

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

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.GregorianCalendar
AD, BC
 
Fields inherited from class java.util.Calendar
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
 
Constructor Summary
EarthClock(java.lang.String dateString)
          Constructor
 
Method Summary
 void addTime(double seconds)
          Adds time to the calendar
 java.lang.String getTimeStamp()
          Returns the date/time formatted in a string
 java.lang.String toString()
          Displays the string version of the clock.
 
Methods inherited from class java.util.GregorianCalendar
add, clone, computeFields, computeTime, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, hashCode, isLeapYear, roll, roll, setGregorianChange, setTimeZone
 
Methods inherited from class java.util.Calendar
after, before, clear, clear, compareTo, complete, get, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EarthClock

public EarthClock(java.lang.String dateString)
           throws java.lang.Exception
Constructor

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

getTimeStamp

public java.lang.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"

addTime

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

Parameters:
seconds - seconds added to the calendar

toString

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

Overrides:
toString in class java.util.Calendar
Returns:
time stamp string.