当前位置: 首页>>代码示例>>C++>>正文


C++ Timestamp::toFormattedString方法代码示例

本文整理汇总了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();

}
开发者ID:1suming,项目名称:msmuduo,代码行数:16,代码来源:TcpServer_test_tcpserver3.cpp

示例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;

}
开发者ID:1suming,项目名称:msmuduo,代码行数:16,代码来源:Timestamp_test.cpp

示例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();
    }
}
开发者ID:catxuxiang,项目名称:SocketTest,代码行数:21,代码来源:mytcpclient.cpp

示例4: LOG

TEST(TimestampTest, Ops) {
  Timestamp stamp = Timestamp::now();
  LOG(INFO) << stamp.toFormattedString();
}
开发者ID:duanbing,项目名称:gingko,代码行数:4,代码来源:timestamp_test.cpp

示例5: defaultReadEventCallback

void defaultReadEventCallback(Timestamp ts)
{
    LOG_INFO << "defaultReadEventCallback [" << ts.toFormattedString() << "]";
}
开发者ID:kevinneu,项目名称:dbdky_cma,代码行数:4,代码来源:eventloop_ex.cpp

示例6: timePubish

	void timePubish()
	{
		Timestamp now = Timestamp::now();
		doPublish("internal", "utc_time", now.toFormattedString(), now);
	}
开发者ID:1suming,项目名称:msmuduo,代码行数:5,代码来源:hub.cpp

示例7: timePublish

 void timePublish() {
     Timestamp now = Timestamp::now();
     distributePublish("utc_time", now.toFormattedString().data());
 }
开发者ID:project-zerus,项目名称:sandbox,代码行数:4,代码来源:Hub.cpp


注:本文中的Timestamp::toFormattedString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。