ITimeStamp
- Objects of ITimeStamp class represent a specific point in time. An ITimeStamp object can be created
from an IDate object, an IDate and ITime object, or a value that represents the number of seconds from
the reference date 01/01/2000 00:00:00. If the timestamp is referring to a point in time before the reference
date, a negative value must be used.
Accuracy is to the second since the time stamp is stored in seconds from a base time. Since the seconds
are stored in a double, the time span representable is grotesquely large. Even represented in millenia,
the size of the number is so large as to not be worth reproducing here.
This class provides functions to obtain specific information about an ITimeStamp object, compare
between ITimeStamp objects, and manipulate an ITimeStamp object.
ITimeStamp - Member Functions and Data by Group
Constructors & Destructor
Constuct and destruct timestamp objects.
- ITimeStamp
- You can construct objects of this class by:
- giving a number of seconds from the reference date 01/01/2000 00:00:00.
- giving an IDate object only.
- giving an IDate and an ITime obects.
- copying from another ITimeStamp object.
Overload 1
public:
ITimeStamp(const ITimeStamp& aTimeStamp)
- Constructs an ITimeStamp object
by copying another ITimeStamp object.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 2
public:
ITimeStamp(const IDate& aDate, const ITime& aTime)
- Constructs an ITimeStamp object by
supplying an IDate and an ITime obect.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 3
public:
ITimeStamp(const IDate& aDate)
- Construct an object of this class by
giving an IDate object.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 4
public:
ITimeStamp(double seconds = 0.0)
- Constructs an object of this class by
giving a number of seconds from the reference date 01/01/2000 00:00:00.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Comparisons
These methods compare one timestamp to another for equality or relative magnitude.
- operator !=
public:
bool operator !=(const ITimeStamp& aTimeStamp) const
- If the ITimeStamp objects represent different timestamp, true is returned.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator <
public:
bool operator <(const ITimeStamp& aTimeStamp) const
- If the left-hand operand represents a timestamp prior to the timestamp represented by the right-hand operand,
true is returned.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator <=
public:
bool operator <=(const ITimeStamp& aTimeStamp) const
- If the left-hand operand represents a timestamp prior to or identical to the
timestamp represented by the right-hand operand, true is returned.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator ==
public:
bool operator ==(const ITimeStamp& aTimeStamp) const
- If the ITimeStamp objects represent the same timestamp, true is returned.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator >
public:
bool operator >(const ITimeStamp& aTimeStamp) const
- If the left-hand operand represents a timestamp subsequent to the timestamp represented by the
right-hand operand, true is returned.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator >=
public:
bool operator >=(const ITimeStamp& aTimeStamp) const
- If the left-hand operand represents a timestamp subsequent to or identical to the
timestamp represented by the right-hand operand, true is returned.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Constants
Class constants.
- secondsInDay
public:
static const double secondsInDay
A constant value which represents a number of seconds in a day.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Current Date and Time
Query the current time stamp.
- currentTimeStamp
public:
static ITimeStamp currentTimeStamp()
- Returns the current timestamp.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Diagnostics
Return the timestamp information in a string or format it to an output stream.
- asString
public:
IString asString() const
- Returns the ITimeStamp as an IString object which shows what the
ITimeStamp represents in terms of date and time format.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- OS/2 Considerations
To obtain locale-sensitive result, you must enable locale-based string operation
by calling
IString::enableInternationalization().
- Windows Considerations
To obtain locale-sensitive result, you must enable locale-based string operation
by calling
IString::enableInternationalization().
Manipulations
Perform mathematical operations on timestamps.
- operator +
public:
ITimeStamp operator +(double seconds) const
- The given number of seconds is added to the ITimeStamp object, yielding a new ITimeStamp.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator +=
public:
ITimeStamp& operator +=(double seconds)
- The ITimeStamp object is modified by adding the given number of seconds.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator -
- If the right-hand operand is a number of seconds, the ITimeStamp object
subtracts the value, yielding a new ITimeStamp.
If the right-hand operand is an ITimeStamp object, the operator yields
the number of seconds difference between the two
timestamps. The difference is negative if the receiver
ITimeStamp has timestamp value before the right-hand operand.
Overload 1
public:
double operator -(const ITimeStamp& aTimeStamp) const
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 2
public:
ITimeStamp operator -(double seconds) const
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator -=
public:
ITimeStamp& operator -=(double seconds)
- The ITimeStamp object is modified by subtracting the given number of seconds.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Queries
Query state information from the object.
- asSeconds
public:
double asSeconds() const
- Returns the number of seconds from the reference date
01/01/2000 00:00:00.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Streaming Support
Binary streaming support.
- operator <<=
public:
void operator <<=(IDataStream& fromWhere)
- Streams this object in from the passed data stream.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator >>=
public:
void operator >>=(IDataStream& toWhere)
- Streams this object out to the passed data stream.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- readFromStream
protected:
void readFromStream(IDataStream& fromWhere)
- Support function for streaming in time stamp objects from a stream.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- writeToStream
protected:
void writeToStream(IDataStream& toWhere) const
- Support method for streaming time stamp objects out to a stream.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Type Conversions
Convert time stamps into legacy date or time objects.
- operator IDate
public:
operator IDate() const
- Returns an IDate object. Only full days are counted, seconds that are a
fraction of the day will be truncated.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator ITime
public:
operator ITime() const
- Returns an ITime object. Only the integral part of seconds that are a fraction
of the day will be kept.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
ITimeStamp - Inherited Member Functions and Data
Inherited Public Functions
Inherited Public Data
Inherited Protected Functions
Inherited Protected Data