Streaming C++ API
11.0.0.3
|
Class for representing moments in time and intervals at millisecond granularity. More...
#include <Timestamp.hpp>
Public Member Functions | |
Timestamp () | |
Create a default Timestamp. More... | |
Timestamp | operator- () const |
Negate an interval to return an interval. More... | |
Timestamp | operator- (const Timestamp &rhs) const |
Subtract two Timestamps to return an interval. More... | |
Timestamp | operator+ (const Timestamp &rhs) const |
Add a Timestamp and an interval to get a Timestamp. More... | |
Timestamp & | operator+= (const Timestamp &rhs) |
Increment the Timestamp by the interval. More... | |
Timestamp & | operator-= (const Timestamp &rhs) |
Decrement the Timestamp by the interval. More... | |
template<typename T > | |
Timestamp | operator* (T rhs) const |
Multiply a Timestamp representing an interval by a constant. More... | |
template<typename T > | |
Timestamp & | operator*= (T rhs) |
Multiply a Timestamp representing an interval by a constant. More... | |
template<typename T > | |
Timestamp | operator/ (T rhs) const |
Divide a Timestamp representing an interval by a constant. More... | |
template<typename T > | |
Timestamp & | operator/= (T rhs) |
Divide a Timestamp representing an interval by a constant. More... | |
double | operator/ (Timestamp rhs) const |
Divide two Timestamps representing an interval to find their quotient. More... | |
Timestamp | operator% (const Timestamp &rhs) const |
Modulo a Timestamp by an interval. More... | |
Timestamp | operator%= (const Timestamp &rhs) |
Modulo a Timestamp by an interval. More... | |
bool | operator< (const Timestamp &rhs) const |
Return true if this Timestamp is before rhs. More... | |
bool | operator<= (const Timestamp &rhs) const |
Return true if this Timestamp is before or at the same time as rhs. More... | |
bool | operator== (const Timestamp &rhs) const |
Return true if this Timestamp is at the same time as rhs. More... | |
bool | operator!= (const Timestamp &rhs) const |
Return true if this Timestamp is not at the same time as rhs. More... | |
bool | operator>= (const Timestamp &rhs) const |
Return true if this Timestamp is after or at the same time as rhs. More... | |
bool | operator> (const Timestamp &rhs) const |
Return true if this Timestamp is after rhs. More... | |
bool | isInterval () const |
Return true if this Timestamp is an interval. More... | |
long long | toMsecs () const |
Return the time as milliseconds. More... | |
long long | toSecs () const |
Return the time as seconds. More... | |
int | compare (const Timestamp &other) const |
compare 2 timestamps return less than zero this < other return greater than zero this > other return 0 if they are the same More... | |
double | getSecond () const |
Return seconds after the minute. More... | |
double | getMillisecond () const |
Return milliseconds after the second. More... | |
int | getMinute () const |
Return minutes after hour. More... | |
int | getHour () const |
Return hours since midnight. More... | |
int | getDayOfWeek () const |
Return day since Sunday. More... | |
int | getDayOfMonth () const |
Return day of month. More... | |
int | getMonth () const |
Return month since January. More... | |
int | getYear () const |
Return year. More... | |
void | setSecond (double seconds) |
Set seconds after the minute. More... | |
void | setMinute (int minutes) |
Set minutes after the hour. More... | |
void | setHour (int hours) |
Set hours since midnight. More... | |
void | setDayOfMonth (int day_of_month) |
Set day of month. More... | |
void | setMonth (int month) |
Set month since January. More... | |
void | setYear (int year) |
Set year. More... | |
std::string | as_string (bool displayTimezone=true) const |
Return a human readable string rep of this Timestamp. More... | |
Static Public Member Functions | |
static Timestamp | now () |
Return a Timestamp representing the current moment in time. More... | |
static Timestamp | milliseconds (long long milliseconds) |
Create a time from a count of milliseconds. More... | |
template<typename T > | |
static Timestamp | seconds (T seconds) |
Create a time from a count of seconds. More... | |
static Timestamp | seconds (double seconds) |
Create a time from a count of seconds. More... | |
template<typename T > | |
static Timestamp | minutes (T minutes) |
Construct an interval from minutes. More... | |
static Timestamp | minutes (double minutes) |
Construct an interval from minutes. More... | |
template<typename T > | |
static Timestamp | hours (T hours) |
Construct an interval from hours. More... | |
static Timestamp | hours (double hours) |
Construct an interval from hours. More... | |
template<typename T > | |
static Timestamp | days (T days) |
Construct an interval from days. More... | |
static Timestamp | days (double days) |
Construct an interval from days. More... | |
template<typename T > | |
static Timestamp | weeks (T weeks) |
Construct an interval from weeks. More... | |
static Timestamp | weeks (double weeks) |
Construct an interval from weeks. More... | |
Class for representing moments in time and intervals at millisecond granularity.
|
inline |
Create a default Timestamp.
Will initialized to 00:00:00 1 Jan 1970.
std::string sb::Timestamp::as_string | ( | bool | displayTimezone = true | ) | const |
Return a human readable string rep of this Timestamp.
|
inline |
compare 2 timestamps return less than zero this < other return greater than zero this > other return 0 if they are the same
|
inlinestatic |
Construct an interval from days.
|
inlinestatic |
Construct an interval from days.
int sb::Timestamp::getDayOfMonth | ( | ) | const |
Return day of month.
int sb::Timestamp::getDayOfWeek | ( | ) | const |
Return day since Sunday.
int sb::Timestamp::getHour | ( | ) | const |
Return hours since midnight.
double sb::Timestamp::getMillisecond | ( | ) | const |
Return milliseconds after the second.
int sb::Timestamp::getMinute | ( | ) | const |
Return minutes after hour.
int sb::Timestamp::getMonth | ( | ) | const |
Return month since January.
double sb::Timestamp::getSecond | ( | ) | const |
Return seconds after the minute.
int sb::Timestamp::getYear | ( | ) | const |
Return year.
|
inlinestatic |
Construct an interval from hours.
|
inlinestatic |
Construct an interval from hours.
|
inline |
Return true if this Timestamp is an interval.
|
inlinestatic |
Create a time from a count of milliseconds.
|
inlinestatic |
Construct an interval from minutes.
|
inlinestatic |
Construct an interval from minutes.
|
static |
Return a Timestamp representing the current moment in time.
|
inline |
Return true if this Timestamp is not at the same time as rhs.
Modulo a Timestamp by an interval.
Modulo a Timestamp by an interval.
|
inline |
Multiply a Timestamp representing an interval by a constant.
|
inline |
Multiply a Timestamp representing an interval by a constant.
Increment the Timestamp by the interval.
Timestamp sb::Timestamp::operator- | ( | ) | const |
Negate an interval to return an interval.
Negate a timestamp to return a timestamp, even though that doesn't make much sense.
Decrement the Timestamp by the interval.
|
inline |
Divide a Timestamp representing an interval by a constant.
|
inline |
Divide two Timestamps representing an interval to find their quotient.
|
inline |
Divide a Timestamp representing an interval by a constant.
|
inline |
Return true if this Timestamp is before rhs.
|
inline |
Return true if this Timestamp is before or at the same time as rhs.
|
inline |
Return true if this Timestamp is at the same time as rhs.
|
inline |
Return true if this Timestamp is after rhs.
|
inline |
Return true if this Timestamp is after or at the same time as rhs.
|
inlinestatic |
Create a time from a count of seconds.
|
inlinestatic |
Create a time from a count of seconds.
void sb::Timestamp::setDayOfMonth | ( | int | day_of_month | ) |
Set day of month.
void sb::Timestamp::setHour | ( | int | hours | ) |
Set hours since midnight.
void sb::Timestamp::setMinute | ( | int | minutes | ) |
Set minutes after the hour.
void sb::Timestamp::setMonth | ( | int | month | ) |
Set month since January.
void sb::Timestamp::setSecond | ( | double | seconds | ) |
Set seconds after the minute.
void sb::Timestamp::setYear | ( | int | year | ) |
Set year.
|
inline |
Return the time as milliseconds.
|
inline |
Return the time as seconds.
|
inlinestatic |
Construct an interval from weeks.
|
inlinestatic |
Construct an interval from weeks.