CppCMS
|
This class represents POSIX time. More...
#include <booster/booster/posix_time.h>
Public Member Functions | |
ptime (long long seconds=0, int nano=0) | |
long long | get_seconds () const |
int | get_nanoseconds () const |
int | get_milliseconds () const |
int | get_microseconds () const |
ptime | operator+ (ptime const &other) const |
ptime | operator- (ptime const &other) const |
bool | operator== (ptime const &other) const |
bool | operator!= (ptime const &other) const |
bool | operator< (ptime const &other) const |
bool | operator> (ptime const &other) const |
bool | operator<= (ptime const &other) const |
bool | operator>= (ptime const &other) const |
Static Public Member Functions | |
static long long | seconds (ptime const &p) |
static ptime | seconds (long long v) |
static long long | milliseconds (ptime const &p) |
static ptime | milliseconds (long long v) |
static long long | microseconds (ptime const &p) |
static ptime | microseconds (long long v) |
static long long | nanoseconds (ptime const &p) |
static ptime | nanoseconds (long long v) |
static ptime | minutes (long long v) |
static long long | minutes (ptime const &p) |
static long long | hours (ptime const &p) |
static ptime | hours (long long v) |
static long long | days (ptime const &p) |
static ptime | days (long long v) |
static double | to_number (ptime const &t) |
static ptime | from_number (double d) |
static ptime | local_time (std::tm const &v) |
static ptime | universal_time (std::tm const &v) |
static std::tm | local_time (ptime const &v) |
static std::tm | universal_time (ptime const &v) |
static ptime | now () |
static void | millisleep (long long v) |
static void | nanosleep (long long v) |
static void | sleep (ptime const &v) |
Static Public Attributes | |
static ptime const | zero |
This class represents POSIX time.
The time from Jan 1, 1970 in seconds in UTC (without leap seconds) similar to time_t.
ptime internally holds 64 bit integer for seconds part and int for nanoseconds part which gives fine-grained time representation.
booster::ptime::ptime | ( | long long | seconds = 0 , |
int | nano = 0 |
||
) | [inline, explicit] |
Create the POSIX time from seconds and nanoseconds.
References booster::locale::normalize().
static long long booster::ptime::days | ( | ptime const & | p | ) | [inline, static] |
Get amount of full days in p
References get_seconds().
static ptime booster::ptime::days | ( | long long | v | ) | [inline, static] |
Convert days v to ptime.
static ptime booster::ptime::from_number | ( | double | d | ) | [inline, static] |
Convert floating point number d that represents POSIX time in seconds to ptime
int booster::ptime::get_microseconds | ( | ) | const [inline] |
Get the microseconds fraction part of POSIX time (which is equal to get_nanoseconds() / 1,000)
int booster::ptime::get_milliseconds | ( | ) | const [inline] |
Get the milliseconds fraction part of POSIX time (which is equal to get_nanoseconds() / 1,000,000)
Referenced by milliseconds().
int booster::ptime::get_nanoseconds | ( | ) | const [inline] |
Get the nanoseconds fraction part of POSIX time
Referenced by microseconds(), and nanoseconds().
long long booster::ptime::get_seconds | ( | ) | const [inline] |
Get the seconds part of POSIX time
Referenced by days(), hours(), microseconds(), milliseconds(), minutes(), and nanoseconds().
static long long booster::ptime::hours | ( | ptime const & | p | ) | [inline, static] |
Get amount of full hours in p
References get_seconds().
static ptime booster::ptime::hours | ( | long long | v | ) | [inline, static] |
Convert hours v to ptime.
static ptime booster::ptime::local_time | ( | std::tm const & | v | ) | [static] |
Convert local time to POSIX time similar to mktime
static std::tm booster::ptime::local_time | ( | ptime const & | v | ) | [static] |
Convert POSIX time v to a local time similar to localtime_r
static long long booster::ptime::microseconds | ( | ptime const & | p | ) | [inline, static] |
Get amount of full microseconds in p. Not the same as p.get_microseconds() as takes seconds as well
References get_nanoseconds(), and get_seconds().
static ptime booster::ptime::microseconds | ( | long long | v | ) | [inline, static] |
Convert a microseconds v to ptime.
static long long booster::ptime::milliseconds | ( | ptime const & | p | ) | [inline, static] |
Get amount of full milliseconds in p. Not the same as p.get_milliseconds() as takes seconds as well
References get_milliseconds(), and get_seconds().
static ptime booster::ptime::milliseconds | ( | long long | v | ) | [inline, static] |
Convert a milliseconds v to ptime.
static void booster::ptime::millisleep | ( | long long | v | ) | [inline, static] |
Sleep at least v milliseconds
static ptime booster::ptime::minutes | ( | long long | v | ) | [inline, static] |
Get amount of full minutes in p
static long long booster::ptime::minutes | ( | ptime const & | p | ) | [inline, static] |
Convert minutes v to ptime.
References get_seconds().
static long long booster::ptime::nanoseconds | ( | ptime const & | p | ) | [inline, static] |
Get amount of nanoseconds in p Not the same as p.get_nanoseconds() as takes seconds as well
References get_nanoseconds(), and get_seconds().
static ptime booster::ptime::nanoseconds | ( | long long | v | ) | [inline, static] |
Convert a nanoseconds v to ptime.
static void booster::ptime::nanosleep | ( | long long | v | ) | [inline, static] |
Sleep at least v nanoseconds
static ptime booster::ptime::now | ( | ) | [static] |
Get current time
Add two POSIX time ranges (as numbers)
Subtract one time from other (as number)
static long long booster::ptime::seconds | ( | ptime const & | p | ) | [inline, static] |
Get amount of full seconds in p
static ptime booster::ptime::seconds | ( | long long | v | ) | [inline, static] |
Convert a seconds v to ptime.
static void booster::ptime::sleep | ( | ptime const & | v | ) | [static] |
Sleep at least v amount of time.
static double booster::ptime::to_number | ( | ptime const & | t | ) | [inline, static] |
Convert t to floating point number that represents POSIX time in seconds
static ptime booster::ptime::universal_time | ( | std::tm const & | v | ) | [static] |
Convert universal time to POSIX time similar to timegm or mktime in GMT timezone
static std::tm booster::ptime::universal_time | ( | ptime const & | v | ) | [static] |
Convert POSIX time v to a GMT time similar to gmtime_r
ptime const booster::ptime::zero [static] |
Same as ptime() -- 0 in terms of POSIX time