All Frameworks Class Hierarchy This Framework Previous Next Indexes
System Class CATTimeSpan
CATTimeSpan
Usage: you must use this class as is. You should never derive it.
public class CATTimeSpan
Class to use for a time difference representation.
CATTimeSpan has to be used whenever a time representation is
needed, ie either seen, entered, or manipulated by the
end user. In this way, the application is shielded from
implementation details regarding language, locale, and so forth.
Applications thus become portable since they can handle
time expressed in any language.
Constructor and Destructor Index
- o
CATTimeSpan()
- Constructs an empty instance.
- o
CATTimeSpan(CATTimeSpan&)
- Copy constructor.
- o
CATTimeSpan(long,int,int,int)
- Constructs an instance from elapsed time components,
Elapsed TimeSpan range : ±68 years.
- o
CATTimeSpan(time_t)
- Constructs an instance from time_t variable (see C RunTime Library).
- o
~CATTimeSpan()
-
Method Index
- o
ConvertToString(CATUnicodeString&)
- Converts elapsed time to CATUnicodeString depending on locale conventions and geographical standpoint.
- o
GetDays()
- Returns the number of complete days in this CATTimeSpan.
- o
GetHours()
- Returns the number of hours in the current day.
- o
GetMinutes()
- Returns the number of minutes in the current hour.
- o
GetSeconds()
- Returns the number of seconds in the current minute.
- o
GetStatus()
- Returns the status of this CATTimeSpan Object.
- o
GetTotalHours()
- Returns the total number of complete hours in this CATTimeSpan.
- o
GetTotalMinutes()
- Returns the total number of complete minutes in this CATTimeSpan.
- o
GetTotalSeconds()
- Returns the total number of complete seconds in this CATTimeSpan.
- o
Gettime_t()
- Returns the time_t representing elapsed time.
- o
SetTimeSpan(long,int,int,int)
- Recycles an existing instance from every Elapsed Time components.
- o
Settime_t(time_t)
- Recycles an existing instance from time_t variable (see C RunTime Library).
- o
operator !=(CATTimeSpan&)
- Inequality operator.
- o
operator >(CATTimeSpan&)
- Greater-than operator.
- o
operator >=(CATTimeSpan&)
- Greater-than or equal operator.
- o
operator <(CATTimeSpan&)
- Less-than operator.
- o
operator <=(CATTimeSpan&)
- Less-than or equal operator.
- o
operator +(CATTimeSpan&)
- Addition operator.
- o
operator +=(CATTimeSpan&)
- Addition assignment operator.
- o
operator -(CATTimeSpan&)
- Substraction operator.
- o
operator -=(CATTimeSpan&)
- Substraction assignment operator.
- o
operator =(CATTimeSpan&)
- Assignment operator from a CATTimeSpan instance.
- o
operator =(time_t)
- Assignment operator from a time_t.
- o
operator ==(CATTimeSpan&)
- Equality operator.
Constructor and Destructor
o CATTimeSpan
-
Constructs an empty instance.
o CATTimeSpan
-
Copy constructor.
- Parameters:
-
- iTimeSpan
- The CATTimeSpan to copy
o CATTimeSpan
public CATTimeSpan( | long | iDays, |
| int | iHours, |
| int | iMins, |
| int | iSecs) |
-
Constructs an instance from elapsed time components,
Elapsed TimeSpan range : ±68 years.
- Parameters:
-
- iDays
- Days Legal values: from -25296 to +25296.
- iHours
- Hours Legal values: from -23 to +23.
- iMins
- Minutes Legal values: from -59 to +59.
- iSecs
- Seconds Legal values: from -59 to +59.
o CATTimeSpan
public CATTimeSpan( | time_t | iTimeSpan) |
-
Constructs an instance from time_t variable (see C RunTime Library).
- Parameters:
-
- iTimeSpan
- time_t representation of Elapsed Time.
o ~CATTimeSpan
-
Methods
o ConvertToString
-
Converts elapsed time to CATUnicodeString depending on locale conventions and geographical standpoint.
- Parameters:
-
- iFormatString
- The format of the requested string in which the following substitutions occur:
- %D ->
GetDays - %H ->
GetHours
- %M ->
GetMinutes
- %S ->
GetSeconds
- %h ->
GetTotalHours
- %m ->
GetTotalMinutes
- %s ->
GetTotalSeconds
- %% -> %
- Returns:
- CATUnicodeString representing elapsed time.
o GetDays
public int GetDays( | )const |
-
Returns the number of complete days in this CATTimeSpan.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the number of complete days.
o GetHours
public int GetHours( | )const |
-
Returns the number of hours in the current day.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the number of hours in the current day. Legal values: -23 through 23
o GetMinutes
public int GetMinutes( | )const |
-
Returns the number of minutes in the current hour.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the number of minutes in the current hour. Legal values: -59 through 59
o GetSeconds
public int GetSeconds( | )const |
-
Returns the number of seconds in the current minute.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the number of seconds in the current minute. Legal values: -59 through 59
o GetStatus
public int GetStatus( | )const |
-
Returns the status of this CATTimeSpan Object.
The status of a CATTimeSpan object is invalid in the following cases :
- If its value is set from a time_t value that could not be converted to a valid elapsed time value.
- If its value is set by
CATTime.SetDateTime with invalid parameter values.
- If this object has experienced an overflow or underflow during an arithmetic assignement operation ( +, -, +=, etc.).
- If an invalid value was assigned to this object.
- Returns:
-
Legal values:
- 1
- this is a Valid CATTimeSpan Object
- 0
- this is a not Valid CATTimeSpan Object
o GetTotalHours
public long GetTotalHours( | )const |
-
Returns the total number of complete hours in this CATTimeSpan.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the total number of complete hours.
o GetTotalMinutes
public long GetTotalMinutes( | )const |
-
Returns the total number of complete minutes in this CATTimeSpan.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the total number of complete minutes.
o GetTotalSeconds
public long GetTotalSeconds( | )const |
-
Returns the total number of complete seconds in this CATTimeSpan.
The result is inconsistent if this is an invalid CATTimeSpan object.
- Returns:
- the total number of complete seconds.
o Gettime_t
public time_t Gettime_t( | )const |
-
Returns the time_t representing elapsed time.
The result is inconsistent if this is an Invalid CATTimeSpan Object.
- Returns:
- A time_t representation of elapsed time.
o SetTimeSpan
public int SetTimeSpan( | long | iDays, |
| int | iHours, |
| int | iMins, |
| int | iSecs) |
-
Recycles an existing instance from every Elapsed Time components.
Elapsed TimeSpan range : ±68 years.
- Parameters:
-
- iDays
- Days Legal values: from -25296 to +25296.
- iHours
- Hours Legal values: from -23 to +23.
- iMins
- Minutes Legal values: from -59 to +59.
- iSecs
- Seconds Legal values: from -59 to +59.
- Returns:
-
Legal values:
- 0
- An error occured.
- 1
- Successful
o Settime_t
public int Settime_t( | time_t | iTimeSpan) |
-
Recycles an existing instance from time_t variable (see C RunTime Library).
- Parameters:
-
- iTimeSpan
- time_t representation of elapsed time.
- Returns:
-
Legal values:
- 0
- An error occured.
- 1
- Successful
o operator !=
public int operator !=( | const CATTimeSpan& | iTimeSpanToCompare)const |
-
Inequality operator.
- Returns:
-
Legal values:
- 1
- if compared Objects are different,
- 0
- otherwise,
- -1
- if one or the two compared objects are Invalid for
GetStatus
o operator >
public int operator >( | const CATTimeSpan& | iTimeSpanToCompare)const |
-
Greater-than operator.
- Returns:
-
Legal values:
- 1
- if the Object is superior than iTimeSpanToCompare,
- 0
- otherwise,
- -1
- if one or the two compared objects are Invalid for
GetStatus
o operator >=
public int operator >=( | const CATTimeSpan& | iTimeSpanToCompare)const |
-
Greater-than or equal operator.
- Returns:
-
Legal values:
- 1
- if the Object is superior than or equal to iTimeSpanToCompare,
- 0
- otherwise,
- -1
- if one or the two compared objects are Invalid for
GetStatus
o operator <
public int operator <( | const CATTimeSpan& | iTimeSpanToCompare)const |
-
Less-than operator.
- Returns:
-
Legal values:
- 1
- if the Object is inferior than iTimeSpanToCompare,
- 0
- otherwise,
- -1
- if one or the two compared objects are Invalid for
GetStatus
o operator <=
public int operator <=( | const CATTimeSpan& | iTimeSpanToCompare)const |
-
Less-than or equal operator.
- Returns:
-
Legal values:
- 1
- if the Object is inferior than or equal to iTimeSpanToCompare,
- 0
- otherwise,
- -1
- if one or the two compared objects are Invalid for
GetStatus
o operator +
-
Addition operator.
- Parameters:
-
- iTimeSpan
- CATTimeSpan instance representing elapsed time to add to.
o operator +=
-
Addition assignment operator.
- Parameters:
-
- iTimeSpan
- CATTimeSpan instance representing elapsed time to add from to.
o operator -
-
Substraction operator.
- Parameters:
-
- iTimeSpan
- CATTimeSpan instance representing elapsed time to substract from.
o operator -=
-
Substraction assignment operator.
- Parameters:
-
- iTimeSpan
- CATTimeSpan instance representing elapsed time to substract from to.
o operator =
-
Assignment operator from a CATTimeSpan instance.
- Parameters:
-
- iTimeSpanToCopy
- CATTimeSpan instance to copy.
o operator =
-
Assignment operator from a time_t.
- Parameters:
-
- iTimeSpanToCopy
- time_t variable to be copied.
o operator ==
public int operator ==( | const CATTimeSpan& | iTimeSpanToCompare)const |
-
Equality operator.
- Returns:
-
Legal values:
- 1
- if compared Objects are equal,
- 0
- otherwise,
- -1
- if one or the two compared objects are Invalid for
GetStatus
This object is included in the file: CATTimeSpan.h
If needed, your Imakefile.mk should include the module: JS0GROUP