本文整理汇总了C++中CTime::toMicroseconds方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::toMicroseconds方法的具体用法?C++ CTime::toMicroseconds怎么用?C++ CTime::toMicroseconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTime
的用法示例。
在下文中一共展示了CTime::toMicroseconds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
CTcpServer server;
server.passiveOpen(5566, 10, true);
char *c = new char[SZ_BUF];
for (int i = 0; i < SZ_BUF; i++)
c[i] = (char)0xaa;
CTcpSocket *conn = server.accept();
ReadingThread reading(*conn, (char)0x55);
reading.start();
unsigned bytecount = 0;
CTime st = CTime::now();
while ((CTime::now() - st) < CTime(T_SEND, 0)) {
bytecount += conn->write(c, SZ_BUF);
}
CTime sendtime = CTime::now() - st;
conn->close();
cout << "Sent " << bytecount << " bytes." << endl;
cout << "Sending rate = " << ((double)bytecount * 8 / 1048576 * 1000000 / sendtime.toMicroseconds()) << " Mbps" << endl;
reading.setDone();
reading.join();
CTime recvtime = CTime::now() - reading.tstart();
cout << "Received " << reading.bytecount() << " bytes." << endl;
cout << "Receiving rate = " << ((double)reading.bytecount() * 8 / 1048576 * 1000000 / recvtime.toMicroseconds()) << " Mbps" << endl;
delete [] c;
return 0;
}