System 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(time_t)
Constructs an instance from time_t variable (see C RunTime Library).
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()

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 =(time_t)
Assignment operator from a time_t.
o operator =(CATTimeSpan&)
Assignment operator from a CATTimeSpan instance.
o operator ==(CATTimeSpan&)
Equality operator.

Constructor and Destructor


o CATTimeSpan
public CATTimeSpan()
Constructs an empty instance.
o CATTimeSpan
public CATTimeSpan( iTimeSpan)
Constructs an instance from time_t variable (see C RunTime Library).
Parameters:
iTimeSpan
time_t representation of Elapsed Time.
o CATTimeSpan
public CATTimeSpan( const iTimeSpan)
Copy constructor.
Parameters:
iTimeSpan
The CATTimeSpan to copy
o CATTimeSpan
public CATTimeSpan( iDays,
iHours,
iMins,
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()

Methods


o ConvertToString
public ConvertToString( const iFormatString)
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 ->
%H ->
%M ->
%S ->
%h ->
%m ->
%s ->
%% -> %
Returns:
CATUnicodeString representing elapsed time.
o GetDays
public GetDays()
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 GetHours()
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 GetMinutes()
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 GetSeconds()
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 GetStatus()
Returns the status of this CATTimeSpan Object. The status of a CATTimeSpan object is invalid in the following cases :
  1. If its value is set from a time_t value that could not be converted to a valid elapsed time value.
  2. If its value is set by with invalid parameter values.
  3. If this object has experienced an overflow or underflow during an arithmetic assignement operation ( +, -, +=, etc.).
  4. 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 GetTotalHours()
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 GetTotalMinutes()
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 GetTotalSeconds()
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 Gettime_t()
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 SetTimeSpan( iDays,
iHours,
iMins,
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 Settime_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 operator !=( const iTimeSpanToCompare)
Inequality operator.
Returns:

Legal values:
1
if compared Objects are different,
0
otherwise,
-1
if one or the two compared objects are Invalid for
o operator >
public operator >( const iTimeSpanToCompare)
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
o operator >=
public operator >=( const iTimeSpanToCompare)
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
o operator <
public operator <( const iTimeSpanToCompare)
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
o operator <=
public operator <=( const iTimeSpanToCompare)
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
o operator +
public operator +( const iTimeSpan)
Addition operator.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add to.
o operator +=
public operator +=( const iTimeSpan)
Addition assignment operator.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add from to.
o operator -
public operator -( const iTimeSpan)
Substraction operator.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from.
o operator -=
public operator -=( const iTimeSpan)
Substraction assignment operator.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from to.
o operator =
public operator =( iTimeSpanToCopy)
Assignment operator from a time_t.
Parameters:
iTimeSpanToCopy
time_t variable to be copied.
o operator =
public operator =( const iTimeSpanToCopy)
Assignment operator from a CATTimeSpan instance.
Parameters:
iTimeSpanToCopy
CATTimeSpan instance to copy.
o operator ==
public operator ==( const iTimeSpanToCompare)
Equality operator.
Returns:

Legal values:
1
if compared Objects are equal,
0
otherwise,
-1
if one or the two compared objects are Invalid for

This object is included in the file: CATTimeSpan.h
If needed, your Imakefile.mk should include the module: JS0GROUP

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.