All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

System Class CATTime

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()
Constructs an instance.
o CATTime(CATTime&)
Copy constructor.
o CATTime(int,int,int,int,int,int)
Constructs an instance from every Date & Time components,
o CATTime(time_t)
Constructs an instance from time_t variable (see C RunTime Library).
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 GetDay()
Returns the day.
o GetDayOfWeek()
Returns the day of the week.
o GetDayOfYear()
Returns the day of the year.
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 SetDate(int,int,int)
Recycles an existing instance from every Date components.
o SetDateTime(int,int,int,int,int,int)
Recycles an existing instance from every Date and Time 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 !=(CATTime&)
Inequality operator.
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.
o operator +(CATTimeSpan&)
Addition operator from CATTimeSpan.
o operator +=(CATTimeSpan&)
Addition assignment operator from CATTimeSpan.
o operator -(CATTime&)
Substraction operator from CATTime.
o operator -(CATTimeSpan&)
Substraction operator from CATTimeSpan.
o operator -=(CATTimeSpan&)
Substraction assignment operator from CATTimeSpan.
o operator =(CATTime&)
Assignment operator from a CATTime instance.
o operator =(time_t)
Assignment operator from a time_t.
o operator ==(CATTime&)
Equality operator.

Constructor and Destructor


o CATTime
public CATTime()
Constructs an instance. Current Date & Time are used for member variable initialization
o CATTime
public CATTime( const CATTime& iTime)
Copy constructor. Constructs an instance from another CATTime instance.
o CATTime
public CATTime(int iYear,
int iMonth,
int iDay,
int iHour,
int iMin,
int 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(time_t iTime)
Constructs an instance from time_t variable (see C RunTime Library).
Parameters:
iTime
time_t representation of Date & Time.
o ~CATTime
public ~CATTime()

Methods


o ConvertToString
public CATUnicodeString ConvertToString( const CATUnicodeString& iFormatString,
int iFlag=0 )const
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 CATTime GetCurrentLocalTime()
Returns an object that represents the current time.
o GetDay
public int GetDay()const
Returns the day. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the day.
o GetDayOfWeek
public int GetDayOfWeek()const
Returns the day of the week. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the day.
o GetDayOfYear
public int GetDayOfYear()const
Returns the day of the year. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the day.
o GetHour
public int GetHour()const
Returns the hour. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the hour
o GetMinute
public int GetMinute()const
Returns the minute. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the minute.
o GetMonth
public int GetMonth()const
Returns the month. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the month.
o GetSecond
public int GetSecond()const
Returns the second. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the second.
o GetStatus
public int GetStatus()const
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 int GetYear()const
Returns the year. The result is inconsistent if this is an Invalid CATTime Object.
Returns:
the year.
o Gettime_t
public time_t Gettime_t()const
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 SetDate
public int SetDate(int iYear,
int iMonth,
int 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 SetDateTime
public int SetDateTime(int iYear,
int iMonth,
int iDay,
int iHour,
int iMin,
int 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 SetTime
public int SetTime(int iHour,
int iMin,
int 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 int Settime_t(time_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 int operator !=( const CATTime& iTimeToCompare)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 CATTime& iTimeToCompare)const
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 int operator >=( const CATTime& iTimeToCompare)const
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 int operator <( const CATTime& iTimeToCompare)const
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 int operator <=( const CATTime& iTimeToCompare)const
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
o operator +
public CATTime operator +( const CATTimeSpan& iTimeSpan)const
Addition operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add to.
o operator +=
public const CATTime& operator +=( const CATTimeSpan& iTimeSpan)
Addition assignment operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add from to.
o operator -
public CATTimeSpan operator -( const CATTime& iTimeToSubstract)const
Substraction operator from CATTime.
Parameters:
iTimeToSubstract
CATTime instance representing date and time to substract from.
o operator -
public CATTime operator -( const CATTimeSpan& iTimeSpan)const
Substraction operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from.
o operator -=
public const CATTime& operator -=( const CATTimeSpan& iTimeSpan)
Substraction assignment operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from to.
o operator =
public CATTime& operator =( const CATTime& iTimeToCopy)
Assignment operator from a CATTime instance.
Parameters:
iTimeToCopy
CATTime instance to copy.
o operator =
public CATTime& operator =(time_t iTimeToCopy)
Assignment operator from a time_t.
Parameters:
iTimeToCopy
time_t variable to be copied.
o operator ==
public int operator ==( const CATTime& iTimeToCompare)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: CATTime.h
If needed, your Imakefile.mk should include the module: JS0GROUP

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