Adbase
Adinf C++ base library V2
|
时间戳工具类 More...
#include <Timestamp.hpp>
Public Member Functions | |
Timestamp () | |
Timestamp (int64_t microSecondsSinceEpochArg) | |
void | swap (Timestamp &that) |
交换 Timestamp 值 More... | |
std::string | toString () const |
将 Timestamp 转化为字符串 More... | |
std::string | toFormattedString (bool showMicroseconds=true) const |
将 Timestamp 格式化为可视化字符串 More... | |
bool | valid () const |
判断 Timestamp 是否合法 More... | |
int64_t | microSecondsSinceEpoch () const |
获取 Timestamp 微秒数 More... | |
time_t | secondsSinceEpoch () const |
获取 Timestamp 秒数 More... | |
Static Public Member Functions | |
static Timestamp | now () |
返回当前时间的 Timestamp 对象 More... | |
static Timestamp | invalid () |
static Timestamp | fromUnixTime (time_t t) |
通过 unix time 构建 Timestamp 对象 More... | |
static Timestamp | fromUnixTime (time_t t, int microseconds) |
通过 unix time 构建 Timestamp 对象, 并且设置微秒数 More... | |
Static Public Attributes | |
static const int | kMicroSecondsPerSecond = 1000 * 1000 |
时间戳工具类
Definition at line 20 of file Timestamp.hpp.
|
inline |
Definition at line 22 of file Timestamp.hpp.
Referenced by adbase::addTime(), fromUnixTime(), invalid(), and now().
|
inlineexplicit |
Definition at line 26 of file Timestamp.hpp.
|
inlinestatic |
|
inlinestatic |
通过 unix time 构建 Timestamp 对象, 并且设置微秒数
Definition at line 153 of file Timestamp.hpp.
References kMicroSecondsPerSecond, and Timestamp().
|
inlinestatic |
Definition at line 133 of file Timestamp.hpp.
References Timestamp().
|
inline |
获取 Timestamp 微秒数
Definition at line 111 of file Timestamp.hpp.
Referenced by adbase::addTime(), adbase::operator<(), adbase::operator==(), adbase::http::Server::setLocationFallback(), and adbase::timeDifference().
|
static |
返回当前时间的 Timestamp 对象
Definition at line 46 of file Timestamp.cpp.
References kMicroSecondsPerSecond, and Timestamp().
Referenced by adbase::AsyncLogging::append(), adbase::TcpConnection::readCallback(), secondsSinceEpoch(), and adbase::http::Server::setLocationFallback().
|
inline |
获取 Timestamp 秒数
Definition at line 121 of file Timestamp.hpp.
References kMicroSecondsPerSecond, and now().
|
inline |
交换 Timestamp 值
that | 交换 Timestamp 值 |
Definition at line 53 of file Timestamp.hpp.
References toFormattedString(), and toString().
std::string adbase::Timestamp::toFormattedString | ( | bool | showMicroseconds = true | ) | const |
将 Timestamp 格式化为可视化字符串
showMicroseconds | 是否显示微妙 |
Definition at line 25 of file Timestamp.cpp.
References kMicroSecondsPerSecond.
Referenced by swap().
std::string adbase::Timestamp::toString | ( | ) | const |
将 Timestamp 转化为字符串
Definition at line 14 of file Timestamp.cpp.
References kMicroSecondsPerSecond.
Referenced by adbase::mc::ClientHandler::onMessage(), adbase::mc::Handler::onMessage(), adbase::head::Handler::onMessage(), and swap().
|
inline |
判断 Timestamp 是否合法
Definition at line 101 of file Timestamp.hpp.
|
static |
Definition at line 157 of file Timestamp.hpp.
Referenced by adbase::addTime(), fromUnixTime(), now(), secondsSinceEpoch(), adbase::http::Server::setLocationFallback(), adbase::timeDifference(), toFormattedString(), and toString().