System 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(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,CATTz&)
Constructs an instance from every Date & Time components,
o ~CATTime()

Method Index


o ConvertToString(CATUnicodeString&,int)
Converts date and time to CATUnicodeString depending on locale conventions and geographical standpoint.
o ConvertToString(CATUnicodeString&,CATTz&)
Same as
o GetCurrentLocalTime()
Returns an object that represents the current time.
o GetDay(CATTz&)
Returns the day.
o GetDayOfWeek(CATTz&)
Returns the day of the week.
o GetDayOfYear(CATTz&)
Returns the day of the year.
o GetHour(CATTz&)
Returns the hour.
o GetMinute(CATTz&)
Returns the minute.
o GetMonth(CATTz&)
Returns the month.
o GetSecond(CATTz&)
Returns the second.
o GetStatus()
Returns the status of this CATTime Object.
o GetYear(CATTz&)
Returns the year.
o Gettime_t()
Returns a time_t structure.
o SetDate(int,int,int,CATTz&)
Recycles an existing instance from every Date components.
o SetDateTime(int,int,int,int,int,int,CATTz&)
Recycles an existing instance from every Date and Time components.
o SetTime(int,int,int,CATTz&)
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 =(time_t)
Assignment operator from a time_t.
o operator =(CATTime&)
Assignment operator from a CATTime instance.
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( 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,
const iTimeZone= CATLocal)
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
iTimeZone
Time zone value (Default is CATLocal).
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 ConvertToString
public ConvertToString( const iFormatString,
const iTimeZone)
Same as .
Parameters:
iTimeZone
Time zone value
o GetCurrentLocalTime
public static GetCurrentLocalTime()
Returns an object that represents the current time.
o GetDay
public GetDay( const iTimeZone= CATLocal)
Returns the day. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
Returns:
the day.
o GetDayOfWeek
public GetDayOfWeek( const iTimeZone= CATLocal)
Returns the day of the week. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
Returns:
the day.
o GetDayOfYear
public GetDayOfYear( const iTimeZone= CATLocal)
Returns the day of the year. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
Returns:
the day.
o GetHour
public GetHour( const iTimeZone= CATLocal)
Returns the hour. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
Returns:
the hour
o GetMinute
public GetMinute( const iTimeZone= CATLocal)
Returns the minute. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
Returns:
the minute.
o GetMonth
public GetMonth( const iTimeZone= CATLocal)
Returns the month. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
Returns:
the month.
o GetSecond
public GetSecond( const iTimeZone= CATLocal)
Returns the second. The result is inconsistent if this is an Invalid CATTime Object.
Parameters:
iTimeZone
Time zone value (Default is CATLocal).
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 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( const iTimeZone= CATLocal)
Returns the year. The result is inconsistent if this is an Invalid CATTime Object. Time zone value (Default is CATLocal).
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 SetDate
public SetDate( iYear,
iMonth,
iDay,
const iTimeZone= CATLocal)
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.
iTimeZone
Time zone value (Default is CATLocal).
Returns:

Legal values:
1
Successful.
0
An error occurred.
o SetDateTime
public SetDateTime( iYear,
iMonth,
iDay,
iHour,
iMin,
iSec,
const iTimeZone= CATLocal)
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
iTimeZone
Time zone value (Default is CATLocal).
Returns:

Legal values:
1
Successful.
0
An error occurred.
o SetTime
public SetTime( iHour,
iMin,
iSec,
const iTimeZone= CATLocal)
Recycles an existing instance from every Time components.
Parameters:
iHour
Hour
iMin
Minutes
iSec
Seconds
iTimeZone
Time zone value (Default is CATLocal).
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 !=( 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
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
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
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
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
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)
Addition assignment operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to add from to.
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)
Substraction operator from CATTimeSpan.
Parameters:
iTimeSpan
CATTimeSpan instance representing elapsed time to substract from.
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 =( iTimeToCopy)
Assignment operator from a time_t.
Parameters:
iTimeToCopy
time_t variable to be copied.
o operator =
public operator =( const iTimeToCopy)
Assignment operator from a CATTime instance.
Parameters:
iTimeToCopy
CATTime instance to copy.
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

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

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