|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ofbiz.base.util.TimeDuration
public class TimeDuration
A representation of a period of time.
Nested Class Summary | |
---|---|
protected static class |
TimeDuration.NullDuration
|
Field Summary | |
---|---|
protected int |
days
|
protected int |
hours
|
protected int |
millis
|
protected int |
minutes
|
protected int |
months
|
protected int |
seconds
|
protected int |
years
|
static TimeDuration |
ZeroTimeDuration
A TimeDuration instance that represents a zero time duration. |
Constructor Summary | |
---|---|
protected |
TimeDuration()
|
|
TimeDuration(java.util.Calendar cal1,
java.util.Calendar cal2)
Elapsed time constructor. |
|
TimeDuration(int years,
int months,
int days,
int hours,
int minutes,
int seconds,
int millis)
|
Method Summary | |
---|---|
java.util.Calendar |
addToCalendar(java.util.Calendar cal)
Add this time duration to a Calendar instance. |
protected int |
advanceCalendar(java.util.Calendar start,
java.util.Calendar end,
int units,
int type)
|
int |
days()
Returns the days in this time duration. |
boolean |
equals(java.lang.Object obj)
|
static TimeDuration |
fromLong(long millis)
Returns a TimeDuration instance derived from a long
value. |
int |
hours()
Returns the hours in this time duration. |
protected void |
makeNegative()
|
int |
millis()
Returns the milliseconds in this time duration. |
int |
minutes()
Returns the minutes in this time duration. |
int |
months()
Returns the months in this time duration. |
int |
seconds()
Returns the seconds in this time duration. |
protected void |
set(java.util.Calendar cal1,
java.util.Calendar cal2)
|
static long |
toLong(TimeDuration duration)
Returns a long value derived from a TimeDuration
instance. |
java.lang.String |
toString()
|
int |
years()
Returns the years in this time duration. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final TimeDuration ZeroTimeDuration
TimeDuration
instance that represents a zero time duration.
protected int millis
protected int seconds
protected int minutes
protected int hours
protected int days
protected int months
protected int years
Constructor Detail |
---|
protected TimeDuration()
public TimeDuration(int years, int months, int days, int hours, int minutes, int seconds, int millis)
years
- The number of years in this durationmonths
- The number of months in this durationdays
- The number of days in this durationhours
- The number of hours in this durationminutes
- The number of minutes in this durationseconds
- The number of years in this durationmillis
- The number of milliseconds in this durationpublic TimeDuration(java.util.Calendar cal1, java.util.Calendar cal2)
Calendar
instances.
cal1
- cal2
- Method Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int millis()
public int seconds()
public int minutes()
public int hours()
public int days()
public int months()
public int years()
public java.util.Calendar addToCalendar(java.util.Calendar cal)
cal
-
cal
protected void set(java.util.Calendar cal1, java.util.Calendar cal2)
protected int advanceCalendar(java.util.Calendar start, java.util.Calendar end, int units, int type)
protected void makeNegative()
public static TimeDuration fromLong(long millis)
TimeDuration
instance derived from a long
value. This method is intended to be used in tandem with the
toLong
method. The years and months portions of the returned object are based on a Gregorian calendar. Note: this method should not be used to calculate elapsed time - use the elapsed time constructor instead.
millis
- A millisecond value
TimeDuration
instancepublic static long toLong(TimeDuration duration)
long
value derived from a TimeDuration
instance. This method is intended to be used in tandem with the
fromLong
method.
duration
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |