com.sigh.utils.c_time
Class TimeFormatString

java.lang.Object
  extended by com.sigh.utils.c_time.TimeFormatString

public class TimeFormatString
extends java.lang.Object

TimeFormatString used to create a strftime format string coupled to a long value in milliseconds. This class can then be used with a %t reference from Csprintf.sprintf() or from CTime.strftime() to print a time value based on the Java epoch of 1970 January 1

Author:
clarkw

Constructor Summary
TimeFormatString()
          Default constructor which sets the default format string to %c and sets the time to the instant the objects was created.
TimeFormatString(java.lang.String aStrformatString, long aLongValue)
          TimeFormatString constructor takes two parameters:
 
Method Summary
 java.lang.String getFormatString()
          getFormatString -- getter for the format String (there is no setter other than the constructor).
 long getTimeInMilliseconds()
          getTimeInMilliseconds -- getter for the long time in milliseconds (there is no setter other than the constructor).
 void setFormatStringTo(java.lang.String aFormatString)
          Allows user to change the format string for a TimeFormatString object.
 void setTimeInMilliseconds(long timeInMilliseconds)
          Allows the user to change the time in milliseconds of the TimeFormatString object.
static java.lang.String version()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeFormatString

public TimeFormatString()
                 throws java.lang.NullPointerException
Default constructor which sets the default format string to %c and sets the time to the instant the objects was created.

Throws:
java.lang.NullPointerException

TimeFormatString

public TimeFormatString(java.lang.String aStrformatString,
                        long aLongValue)
                 throws java.lang.NullPointerException
TimeFormatString constructor takes two parameters:

Parameters:
aStrformatString - -- a strftime() format string as described in KNR.
aLongValue - -- a long value representing the date/time of interest in milliseconds after 1970 01 01. Negative values will recede in time. Positive values will advance in time.
Throws:
java.lang.NullPointerException
Method Detail

setTimeInMilliseconds

public void setTimeInMilliseconds(long timeInMilliseconds)
Allows the user to change the time in milliseconds of the TimeFormatString object. Means you can set the string and then alter the time value in a loop.

Parameters:
timeInMilliseconds -

setFormatStringTo

public void setFormatStringTo(java.lang.String aFormatString)
Allows user to change the format string for a TimeFormatString object. Allows user to set a time and then alter what is displayed by different format strings.

Parameters:
aFormatString -

getFormatString

public java.lang.String getFormatString()
getFormatString -- getter for the format String (there is no setter other than the constructor).

Returns:
String

getTimeInMilliseconds

public long getTimeInMilliseconds()
getTimeInMilliseconds -- getter for the long time in milliseconds (there is no setter other than the constructor).

Returns:
long

version

public static java.lang.String version()