#include <timeint.h>
Inheritance diagram for PTimeInterval:
Conversion functions | |
enum | Formats { NormalFormat, IncludeDays, SecondsOnly } |
PString | AsString (int decimals=3, Formats format=NormalFormat, int width=1) const |
Public Member Functions | |
Construction | |
PTimeInterval (PInt64 millisecs=0) | |
PTimeInterval (long millisecs, long seconds, long minutes=0, long hours=0, int days=0) | |
PTimeInterval (const PString &str) | |
Overrides from class PObject | |
PObject * | Clone () const |
virtual Comparison | Compare (const PObject &obj) const |
virtual void | PrintOn (ostream &strm) const |
virtual void | ReadFrom (istream &strm) |
Access functions | |
PInt64 | GetMilliSeconds () const |
long | GetSeconds () const |
long | GetMinutes () const |
int | GetHours () const |
int | GetDays () const |
DWORD | GetInterval () const |
virtual void | SetInterval (PInt64 milliseconds=0, long seconds=0, long minutes=0, long hours=0, int days=0) |
Operations | |
PTimeInterval | operator- () const |
PTimeInterval | operator+ (const PTimeInterval &interval) const |
PTimeInterval & | operator+= (const PTimeInterval &interval) |
PTimeInterval | operator- (const PTimeInterval &interval) const |
PTimeInterval & | operator-= (const PTimeInterval &interval) |
PTimeInterval | operator * (int factor) const |
PTimeInterval & | operator *= (int factor) |
PTimeInterval | operator/ (int factor) const |
PTimeInterval & | operator/= (int factor) |
Comparison functions | |
bool | operator== (const PTimeInterval &interval) const |
bool | operator== (long msecs) const |
bool | operator!= (const PTimeInterval &interval) const |
bool | operator!= (long msecs) const |
bool | operator> (const PTimeInterval &interval) const |
bool | operator> (long msecs) const |
bool | operator>= (const PTimeInterval &interval) const |
bool | operator>= (long msecs) const |
bool | operator< (const PTimeInterval &interval) const |
bool | operator< (long msecs) const |
bool | operator<= (const PTimeInterval &interval) const |
bool | operator<= (long msecs) const |
Protected Attributes | |
PInt64 | milliseconds |
Number of milliseconds in time interval. |
A long int is used to store the time interval so it is limited to LONG_MAX (found in the standard C header file limits.h) milliseconds. This is approximately 596 hours for 32 bit integers.
There is a constant, #PMaxTimeInterval# which defines the maximum number of milliseconds that a time interval may be.
|
|
|
Create a new time interval object. The time interval, in milliseconds, is the sum of all of the parameters. For example all of the following are equivalent: {verbatim} PTimeInterval(120000) PTimeInterval(60000, 60) PTimeInterval(60000, 0, 1) PTimeInterval(0, 60, 1) PTimeInterval(0, 0, 2) {verbatim}
|
|
|
|
|
|
|
|
Create a new copy of the time interval. It is the responsibility of the called to delete the object.
Reimplemented from PObject. |
|
Rank the two time intervals. This ranks the intervals as you would expect for two integers.
Reimplemented from PObject. |
|
Get the number of whole days for the time interval.
|
|
Get the number of whole hours for the time interval.
|
|
Get the number of milliseconds for the time interval.
|
|
Get the number of milliseconds for the time interval.
|
|
Get the number of whole minutes for the time interval.
|
|
Get the number of whole seconds for the time interval.
|
|
Multiply the time interval by a factor yielding a third time interval.
|
|
Multiply the time interval by a factor.
|
|
|
|
Compare to the two time intervals. This is provided as an override to the default in PObject so that comparisons can be made to integer literals that represent milliseconds.
|
|
Add the two time intervals yielding a third time interval.
|
|
Add the second time interval to the first time interval.
|
|
Subtract the two time intervals yielding a third time interval.
|
|
Unary minus, get negative of time interval.
|
|
Subtract the second time interval from the first time interval.
|
|
Divide the time interval by a factor yielding a third time interval.
|
|
Divide the time interval by a factor.
|
|
|
|
Compare to the two time intervals. This is provided as an override to the default in PObject so that comparisons can be made to integer literals that represent milliseconds.
|
|
|
|
Compare to the two time intervals. This is provided as an override to the default in PObject so that comparisons can be made to integer literals that represent milliseconds.
|
|
|
|
Compare to the two time intervals. This is provided as an override to the default in PObject so that comparisons can be made to integer literals that represent milliseconds.
|
|
|
|
Compare to the two time intervals. This is provided as an override to the default in PObject so that comparisons can be made to integer literals that represent milliseconds.
|
|
|
|
Compare to the two time intervals. This is provided as an override to the default in PObject so that comparisons can be made to integer literals that represent milliseconds.
|
|
Output the time interval to the I/O stream. This outputs the number of milliseconds as a signed decimal integer number.
Reimplemented from PObject. |
|
Input the time interval from the I/O stream. This expects the input to be a signed decimal integer number.
Reimplemented from PObject. |
|
Set the value of the time interval. The time interval, in milliseconds, is the sum of all of the parameters. For example all of the following are equivalent: {verbatim} SetInterval(120000) SetInterval(60000, 60) SetInterval(60000, 0, 1) SetInterval(0, 60, 1) SetInterval(0, 0, 2) {verbatim}
Reimplemented in PTimer. |
|
Number of milliseconds in time interval.
|