本文整理汇总了C++中Timestamp::toFormattedString方法的典型用法代码示例。如果您正苦于以下问题:C++ Timestamp::toFormattedString方法的具体用法?C++ Timestamp::toFormattedString怎么用?C++ Timestamp::toFormattedString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timestamp
的用法示例。
在下文中一共展示了Timestamp::toFormattedString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMessage
void onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp receiveTime)
{
printf("onMessage(): tid=%d received %d bytes from connection [%s] at %s\n",
CurrentThread::tid(),
buf->readableBytes(),
conn->name().c_str(),
receiveTime.toFormattedString().c_str());
string str(buf->peek(), buf->readableBytes());
printf("str:%s\n", str.c_str());
buf->retrieveAll();
}
示例2: main
int main()
{
Timestamp timestamp = Timestamp::now();
cout << sizeof(A) << endl << sizeof(B) << endl; //1 ,8
cout << sizeof(C) << endl;//windowsƽ̨Ϊ16
cout << "sizeof(copyable):"<<sizeof(copyable)<<endl;
cout << "sizeof(timestamp)"<<sizeof(timestamp) << endl;
cout << endl << endl;
cout << "time seocnds:" << timestamp.secondsSinceEpoch() << endl;
string str = timestamp.toFormattedString();
cout << str << endl;
}
示例3: onMessage
void MyTcpClient::onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp receiveTime)
{
if (buf->readableBytes() >= sizeof(int32_t))
{
/*
const void* data = buf->peek();
int32_t be32 = *static_cast<const int32_t*>(data);
buf->retrieve(sizeof(int32_t));
time_t time = sockets::networkToHost32(be32);
Timestamp ts(implicit_cast<uint64_t>(time) * Timestamp::kMicroSecondsPerSecond);
LOG_INFO << "Server time = " << time << ", " << ts.toFormattedString();
*/
std::string str = static_cast<std::string>(buf->retrieveAllAsString());
LOG_INFO << "Server time = " << str;
}
else
{
LOG_INFO << conn->name() << " no enough data " << buf->readableBytes()
<< " at " << receiveTime.toFormattedString();
}
}
示例4: LOG
TEST(TimestampTest, Ops) {
Timestamp stamp = Timestamp::now();
LOG(INFO) << stamp.toFormattedString();
}
示例5: defaultReadEventCallback
void defaultReadEventCallback(Timestamp ts)
{
LOG_INFO << "defaultReadEventCallback [" << ts.toFormattedString() << "]";
}
示例6: timePubish
void timePubish()
{
Timestamp now = Timestamp::now();
doPublish("internal", "utc_time", now.toFormattedString(), now);
}
示例7: timePublish
void timePublish() {
Timestamp now = Timestamp::now();
distributePublish("utc_time", now.toFormattedString().data());
}