Inheritance diagram for sword::Time:

Public Methods | |
| Time () throw () | |
| Default constructor. | |
| Time (int64 value) throw () | |
| Int64-value constructor. | |
| int64 | serial () const throw () |
| Int64-value read access. | |
| void | serial (int64 value) throw () |
| Int64-value write access. | |
| int | integer1900 () const throw () |
| get the time in the 1900-referential as an integer | |
| Time & | integer1900 (int value) throw () |
| set the time from a 1900-referential integer | |
| double | double1900 () const throw () |
| get the time in the 1900-referential as a double | |
| Time & | double1900 (double value) throw () |
| set the time from a 1900-referential double | |
| bool | valid () const throw () |
| Checks whether this time is valid. | |
| void | invalidate () throw () |
| Set this time as invalid. | |
| void | resetHour () throw () |
| Set the hour part (h:m:s) of this timestamp to 0:0:0. | |
| Time & | roundDay () throw () |
| Rounds this time value to the nearest day. | |
| Time & | roundHour () throw () |
| Rounds this time value to the nearest hour. | |
| Time & | roundMinute () throw () |
| Rounds this time value to the nearest minute. | |
| Time & | roundSecond () throw () |
| Rounds this time value to the nearest second. | |
| Time & | truncDay () throw () |
| Truncs this time value to the nearest day. | |
| Time & | truncHour () throw () |
| Truncs this time value to the nearest hour. | |
| Time & | truncMinute () throw () |
| Truncs this time value to the nearest minute. | |
| Time & | truncSecond () throw () |
| Truncs this time value to the nearest second. | |
| time_t | toC () const |
| void | fromC (time_t value) throw () |
| bool | operator< (const Comparable< Time > &rhs) const |
| '<' operation between this instance and rhs | |
| bool | operator<= (const Comparable< Time > &rhs) const |
| '<=' operation between this instance and rhs | |
| bool | operator> (const Comparable< Time > &rhs) const |
| '>' operation between this instance and rhs | |
| bool | operator>= (const Comparable< Time > &rhs) const |
| '>=' operation between this instance and rhs | |
| bool | operator== (const Comparable< Time > &rhs) const |
| '==' operation between this instance and rhs | |
| bool | operator!= (const Comparable< Time > &rhs) const |
| '!=' operation between this instance and rhs | |
Static Public Methods | |
| Time | now () |
| Get the current time, in local time. | |
| Time | nowUTC () |
| Get the current time, in UTC. | |
| TimeSpan | timeZone () |
| Get the machine current time zone. | |
| int | compare (const Time &lhs, const Time &rhs) |
| Comparison method (used for Ordered<> implementation). | |
Friends | |
| TimeSpan | operator- (const Time &lhs, const Time &rhs) |
| Get the interval between this time and another. | |
| Time | operator+ (const Time &lhs, const TimeSpan &rhs) |
| Adds an interval to this time. | |
| Time | operator+ (const TimeSpan &lhs, const Time &rhs) |
| Adds an interval to this time. | |
| IStream & | operator>> (IStream &lhs, Time &rhs) |
| Streaming onto a sword::IStream. | |
| OStream & | operator<< (OStream &lhs, const Time &rhs) |
| Streaming onto a sword::OStream. | |
A sword::Time holds nothing but a point in time (also called timestamp). The precision is the millisecond. Whenever a timestamp is created it is marked invalid (non initialized), and this state can be tested.
Internally, the storage is a 64-bit signed integer which represents the number of milliseconds since an arbitrary origin (1 Jan 1970 00:00:00 UTC). It can be either positive (point in time after this origin) or negative (point in time before this origin). The authorised dates are approximately in a 292 million years interval backward and forward the origin. There is one special unauthorised value (-2^63-1, the minimum 64-bit signed integer value), which is used to mark an invalid (or non initialized date).
Apart from storing a time value, the Time class provides conversion with these other usefull time referentials:
|
|
Default constructor. The time is set to be invalid |
|
|
Int64-value constructor.
|
|
||||||||||||
|
Comparison method (used for Ordered<> implementation).
|
|
|
set the time from a 1900-referential double
|
|
|
get the time in the 1900-referential as a double
|
|
|
set the time from a 1900-referential integer
|
|
|
get the time in the 1900-referential as an integer
|
|
|
Set this time as invalid.
|
|
|
Get the current time, in local time.
|
|
|
Get the current time, in UTC.
|
|
|
'!=' operation between this instance and rhs
|
|
|
'<' operation between this instance and rhs
|
|
|
'<=' operation between this instance and rhs
|
|
|
'==' operation between this instance and rhs
|
|
|
'>' operation between this instance and rhs
|
|
|
'>=' operation between this instance and rhs
|
|
|
Set the hour part (h:m:s) of this timestamp to 0:0:0.
|
|
|
Rounds this time value to the nearest day.
|
|
|
Rounds this time value to the nearest hour.
|
|
|
Rounds this time value to the nearest minute.
|
|
|
Rounds this time value to the nearest second.
|
|
|
Int64-value write access.
|
|
|
Int64-value read access.
|
|
|
Get the machine current time zone. The timezone can be used to move from local time to Universal time using the formula "UTC + time zone = local time"
|
|
|
Truncs this time value to the nearest day.
|
|
|
Truncs this time value to the nearest hour.
|
|
|
Truncs this time value to the nearest minute.
|
|
|
Truncs this time value to the nearest second.
|
|
|
Checks whether this time is valid.
|
|
||||||||||||
|
Adds an interval to this time.
|
|
||||||||||||
|
Adds an interval to this time.
|
|
||||||||||||
|
Get the interval between this time and another.
|
|
||||||||||||
|
Streaming onto a sword::OStream.
|
|
||||||||||||
|
Streaming onto a sword::IStream.
|
1.3-rc2