com.caucho.config.types
Class Period

java.lang.Object
  extended by com.caucho.config.types.Period
Direct Known Subclasses:
Minutes

public class Period
extends java.lang.Object

Representations of time in milliseconds.


Field Summary
static long DAY
           
static long FOREVER
           
static long HOUR
           
static long INFINITE
           
static long MINUTE
           
static long MONTH
          30 days
static long SECOND
           
static long YEAR
          365 days
 
Constructor Summary
Period()
           
Period(long period)
           
 
Method Summary
 void addText(java.lang.String text)
          Sets the text.
 long getDefaultUnits()
          Returns the default units (default is 1000)
 long getPeriod()
          Replace with the real path.
static long periodEnd(long now, long period)
          Calculates the next period end.
static long toPeriod(java.lang.String value)
          Converts a period string to a time.
static long toPeriod(java.lang.String value, long defaultUnits)
          Converts a period string to a time.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SECOND

public static final long SECOND
See Also:
Constant Field Values

MINUTE

public static final long MINUTE
See Also:
Constant Field Values

HOUR

public static final long HOUR
See Also:
Constant Field Values

DAY

public static final long DAY
See Also:
Constant Field Values

MONTH

public static final long MONTH
30 days

See Also:
Constant Field Values

YEAR

public static final long YEAR
365 days

See Also:
Constant Field Values

INFINITE

public static final long INFINITE
See Also:
Constant Field Values

FOREVER

public static final long FOREVER
See Also:
Constant Field Values
Constructor Detail

Period

public Period()

Period

public Period(long period)
Method Detail

getDefaultUnits

public long getDefaultUnits()
Returns the default units (default is 1000)


addText

public void addText(java.lang.String text)
             throws ConfigException
Sets the text.

Throws:
ConfigException

getPeriod

public long getPeriod()
Replace with the real path.


toPeriod

public static long toPeriod(java.lang.String value)
                     throws ConfigException
Converts a period string to a time.
msmilliseconds
sseconds
mminutes
hhours
Ddays
Wweeks
Mmonths
Yyears

Throws:
ConfigException

toPeriod

public static long toPeriod(java.lang.String value,
                            long defaultUnits)
                     throws ConfigException
Converts a period string to a time.
msmilliseconds
sseconds
mminutes
hhours
Ddays
Wweeks
Mmonths
Yyears

Throws:
ConfigException

periodEnd

public static long periodEnd(long now,
                             long period)
Calculates the next period end. The calculation is in local time.

Parameters:
now - the current time in GMT ms since the epoch
Returns:
the time of the next period in GMT ms since the epoch

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object