Class that represents a timestamp type. More...
#include <SPL/Runtime/Type/Timestamp.h>
Public Member Functions |
|
| constexpr | timestamp () |
| timestamp (int64_t secs, uint32_t nanosecs, uint32_t machineId=0) | |
| timestamp (double time) | |
| timestamp (const timestamp &ot)=default | |
| void | set (int64_t secs, uint32_t nanosecs, uint32_t machineId=0) |
| void | setSeconds (int64_t secs) |
| void | setNanoSeconds (uint32_t nanosecs) |
| void | setMachineId (int32_t machineId) |
| int64_t | getSeconds () const |
| uint32_t | getNanoseconds () const |
| int32_t | getMachineId () const |
| timestamp | operator- (const timestamp &rhs) const |
| timestamp & | operator-= (const timestamp &rhs) |
| timestamp | operator+ (const timestamp &rhs) const |
| timestamp & | operator+= (const timestamp &rhs) |
| bool | operator== (const timestamp &rhs) const |
| bool | operator!= (const timestamp &rhs) const |
| bool | operator< (const timestamp &rhs) const |
| bool | operator>= (const timestamp &rhs) const |
| bool | operator> (const timestamp &rhs) const |
| bool | operator<= (const timestamp &rhs) const |
| void | swap (timestamp &ot) |
| template<class BufferType > | |
| void | serialize (ByteBuffer< BufferType > &buf) const |
| template<class BufferType > | |
| void | deserialize (ByteBuffer< BufferType > &buf) |
| void | serialize (std::ostream &ostr) const |
| void | deserialize (std::istream &istr) |
| size_t | hashCode () const |
| size_t | getSerializedSize () const |
Static Public Member Functions |
|
| static constexpr timestamp | min () |
| The minimum timestamp value. More... |
|
| static constexpr timestamp | max () |
| The maximum timestamp value. More... |
|
Class that represents a timestamp type.
Common usage is to store the seconds and nanoseconds since the Unix Epoch (Jan 1, 1970), but this is not enforced by the timestamp class. machineId may be used to detect if two timestamps were created on the same machine, as there may be variations in the clocks on different machines. machineId's are ignored for comparisons and arithmetic operations on timestamps.
|
inline |
Empty constructor
|
inline |
Constructor
| secs | seconds since epoch |
| nanosecs | nanoseconds |
| machineId | machine id |
|
inline |
Constructor
| time | time in seconds, could be fractional |
|
default |
Copy contructor
| ot | other timestamp |
|
inline |
Set seconds since epoch and nanoseconds
| secs | seconds since epoch |
| nanosecs | nanoseconds |
| machineId | machine id |
|
inline |
Set seconds since epoch
| secs | seconds since epoch |
|
inline |
Set nanoseconds
| nanosecs | nanoseconds |
|
inline |
Set machine id
| machineId | the machine id |
|
inline |
Get seconds since epoch
|
inline |
Get nanoseconds
|
inline |
Get machine id
Difference. The machine id from the left-hand-size operand is used in result.
| rhs | timestamp to subtract |
Difference (assignment)
| rhs | timestamp to subtract |
Sum. The machine id from the left-hand-size operand is used in result.
| rhs | timestamp to add |
Sum (assignment)
| rhs | timestamp to add |
|
inline |
Equality comparison
| rhs | timestamp to compare with |
|
inline |
Non-equality comparison
| rhs | timestamp to compare with |
|
inline |
Less than comparison
| rhs | timestamp to compare with |
|
inline |
Greater than or equal comparison
| rhs | timestamp to compare with |
|
inline |
Greater than comparison
| rhs | timestamp to compare with |
|
inline |
Less than or equal comparison
| rhs | timestamp to compare with |
|
inline |
Swap
| ot | timestamp to swap with |
|
inline |
Serialize (binary)
| buf | byte buffer to use |
|
inline |
Deserialize (binary)
| buf | byte buffer to use |
|
inline |
Serialize (character)
| ostr | output stream |
| void SPL::timestamp::deserialize | ( | std::istream & | istr | ) |
Deserialize (character)
| istr | input stream |
|
inline |
Get hash code
|
inline |
Get the size in bytes when serialized
|
inlinestatic |
The minimum timestamp value.
|
inlinestatic |
The maximum timestamp value.