All Frameworks  Class Hierarchy  This Framework  Indexes   

System Class CATTime

Usage: you must use this class as is. You should never derive it.


public class CATTime

Class to use for date and time representation.

CATTime 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 CATTime(time_t)
Constructs an instance from time_t variable (see C RunTime Library).
o CATTime(CATTime&)
Copy constructor.
o CATTime(int,int,int,int,int,int)
Constructs an instance from every Date & Time components,
o CATTime()
Constructs an instance.
o ~CATTime()

Method Index


o ConvertToString(CATUnicodeString&,int)
Converts date and time to CATUnicodeString depending on locale conventions and geographical standpoint.
o GetCurrentLocalTime()
Returns an object that represents the current time.
o GetDayOfWeek()
Returns the day of the week.
o GetDayOfYear()
Returns the day of the year.
o GetDay()
Returns the day.
o GetHour()
Returns the hour.
o GetMinute()
Returns the minute.
o GetMonth()
Returns the month.
o GetSecond()
Returns the second.
o GetStatus()
Returns the status of this CATTime Object.
o GetYear()
Returns the year.
o Gettime_t()
Returns a time_t structure.
o SetDateTime(int,int,int,int,int,int)
Recycles an existing instance from every Date and Time components.
o SetDate(int,int,int)
Recycles an existing instance from every Date components.
o SetTime(int,int,int)
Recycles an existing instance from every Time components.
o Settime_t(time_t)
Recycles an existing instance from time_t variable (see C RunTime Library).
o operator =(time_t)
Assignment operator from a time_t.
o operator !=(CATTime&)
Inequality operator.
o operator ==(CATTime&)
Equality operator.
o operator =(CATTime&)
Assignment operator from a CATTime instance.
o operator -(CATTime&)
Substraction operator from CATTime.
o operator +(CATTimeSpan&)
Addition operator from CATTimeSpan.
o operator -(CATTimeSpan&)
Substraction operator from CATTimeSpan.
o operator +=(CATTimeSpan&)
Addition assignment operator from CATTimeSpan.
o operator -=(CATTimeSpan&)
Substraction assignment operator from CATTimeSpan.
o operator >(CATTime&)
Greater-than operator.
o operator >=(CATTime&)
Greater-than or equal operator.
o operator <(CATTime&)
Less-than operator.
o operator <=(CATTime&)
Less-than or equal operator.

Constructor and Destructor


o CATTime
public CATTime( iTime)
Constructs an instance from time_t variable (see C RunTime Library).
Parameters:
iTime
time_t representation of Date & Time.
o CATTime
public CATTime( const iTime)
Copy constructor. Constructs an instance from another CATTime instance.
o CATTime
public CATTime( iYear,
iMonth,
iDay,
iHour,
iMin,
iSec)
Constructs an instance from every Date & Time components,
Parameters:
iYear
Year Legal values: from 1970 to 2038.
iMonth
Month Legal values: from 1 to 12.
iDay
Day Legal values: from 1 to 31.
iHour
Hour
iMin
Minute
iSec
Second
o CATTime
public CATTime()
Constructs an instance. Current Date & Time are used for member variable initialization
o ~CATTime
public ~CATTime()

Methods


o ConvertToString
public ConvertToString( const iFormatString,
iFlag=0 )
Converts date and time to CATUnicodeString depending on locale conventions and geographical standpoint.
Parameters:
iFormatString
The Format-control string. See strfime in C RunTime Library for valid format.
Returns:
CATUnicodeString representing date and time.
o GetCurrentLocalTime
public static GetCurrentLocalTime()
Returns an object that represents the current time.
o GetDayOfWeek
public GetDayOfWeek()
Returns the day of the week. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the day.
o GetDayOfYear
public GetDayOfYear()
Returns the day of the year. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the day.
o GetDay
public GetDay()
Returns the day. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the day.
o GetHour
public GetHour()
Returns the hour. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the hour
o GetMinute
public GetMinute()
Returns the minute. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the minute.
o GetMonth
public GetMonth()
Returns the month. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the month.
o GetSecond
public GetSecond()
Returns the second. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the second.
o GetStatus
public GetStatus()
Returns the status of this CATTime Object. The status of a CATTime 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 date and time value.
  2. If its value is set by SetDateTime 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 CATTime Object
0
this is a not Valid CATTime Object
o GetYear
public GetYear()
Returns the year. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the year.
o Gettime_t
public Gettime_t()
Returns a time_t structure. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
A time_t representation of Date & Time
o SetDateTime
public SetDateTime( iYear,
iMonth,
iDay,
iHour,
iMin,
iSec)
Recycles an existing instance from every Date and Time components.
Parameters:
iYear
Year Legal values: from 1970 to 2038.
iMonth
Month Legal values: from 1 to 12.
iDay
Day Legal values: from 1 to 31.
iHour
Hour
iMin
Minute
iSec
Second
Returns:

Legal values:
1
Successful.
0
An error occurred.
o SetDate
public SetDate( iYear,
iMonth,
iDay)
Recycles an existing instance from every Date components.
Parameters:
iYear
Year Legal values: from 1970 to 2038.
iMonth
Month Legal values: from 1 to 12.
iDay
Day Legal values: from 1 to 31.
Returns:

Legal values:
1
Successful.
0
An error occurred.
o SetTime
public SetTime( iHour,
iMin,
iSec)
Recycles an existing instance from every Time components.
Parameters:
iHour
Hour
iMin
Minutes
iSec
Seconds
Returns:

Legal values:
1
Successful.
0
An error occurred.
o Settime_t
public Settime_t( iTime)
Recycles an existing instance from time_t variable (see C RunTime Library).
Parameters:
iTime
time_t representation of Date and Time.
Returns:

Legal values:
1
Successful.
0
An error occurred.
o operator =
public operator =( iTimeToCopy)
Assignment operator from a time_t.
Parameters:
iTimeToCopy
time_t variable to be copied.
o operator !=
public operator !=( const iTimeToCompare)
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 operator ==( const iTimeToCompare)
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
o operator =
public operator =( const iTimeToCopy)
Assignment operator from a CATTime instance.
Parameters:
iTimeToCopy
CATTime instance to copy.
o operator -
public operator -( const iTimeToSubstract)
Substraction operator from CATTime.
Parameters:
iTimeToSubstract
CATTime instance representing date and time to substract from.
o operator +
public operator +( const iTimeSpan)
Addition operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add to.
o operator -
public operator -( const iTimeSpan)
Substraction operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from.
o operator +=
public operator +=( const iTimeSpan)
Addition assignment operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add from to.
o operator -=
public operator -=( const iTimeSpan)
Substraction assignment operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from to.
o operator >
public operator >( const iTimeToCompare)
Greater-than operator.
Returns:

Legal values:
1
if the Object is superior than iTimeToCompare,
0
otherwise,
-1
if one or the two compared objects are Invalid for GetStatus
o operator >=
public operator >=( const iTimeToCompare)
Greater-than or equal operator.
Returns:

Legal values:
1
if the Object is superior than or equal to iTimeToCompare,
0
otherwise,
-1
if one or the two compared objects are Invalid for GetStatus
o operator <
public operator <( const iTimeToCompare)
Less-than operator.
Returns:

Legal values:
1
if the Object is inferior than iTimeToCompare,
0
otherwise,
-1
if one or the two compared objects are Invalid for GetStatus
o operator <=
public operator <=( const iTimeToCompare)
Less-than or equal operator.
Returns:

Legal values:
1
if the Object is inferior than or equal to iTimeToCompare,
0
otherwise,
-1
if one or the two compared objects are Invalid for GetStatus

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

Copyright © 2003, Dassault Systèmes. All rights reserved.