mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
RecvContext增加微秒接口,Current精确接收时间
This commit is contained in:
parent
83d6195935
commit
af41549b63
@ -128,8 +128,8 @@ int Current::getMessageType() const
|
||||
struct timeval Current::getRecvTime() const
|
||||
{
|
||||
timeval tm;
|
||||
tm.tv_sec = _data->recvTimeStamp() / 1000;
|
||||
tm.tv_usec = (_data->recvTimeStamp() % 1000) * 1000;
|
||||
tm.tv_sec = _data->recvTimeStampUs() / 1000000;
|
||||
tm.tv_usec = _data->recvTimeStampUs() % 1000000;
|
||||
|
||||
return tm;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public:
|
||||
, _adapter(adapter)
|
||||
, _isClosed(isClosed)
|
||||
, _closeType(closeType)
|
||||
, _recvTimeStamp(TNOWMS)
|
||||
, _recvTimeStamp(TNOWUS)
|
||||
{}
|
||||
inline int threadIndex() const { return _threadIndex; }
|
||||
inline uint32_t uid() const { return _uid; }
|
||||
@ -196,7 +196,8 @@ public:
|
||||
inline uint16_t port() const { parseIpPort(); return _port; }
|
||||
inline vector<char> & buffer() { return _rbuffer; }
|
||||
inline const vector<char> & buffer() const { return _rbuffer; }
|
||||
inline int64_t recvTimeStamp() const { return _recvTimeStamp; }
|
||||
inline int64_t recvTimeStamp() const { return _recvTimeStamp/1000; }
|
||||
inline int64_t recvTimeStampUs() const { return _recvTimeStamp; }
|
||||
inline bool isOverload() const { return _isOverload; }
|
||||
inline void setOverload() { _isOverload = true; }
|
||||
inline bool isClosed() const { return _isClosed; }
|
||||
@ -232,7 +233,7 @@ public:
|
||||
bool _isOverload = false; /**是否已过载 */
|
||||
bool _isClosed = false; /**是否已关闭*/
|
||||
int _closeType; /*如果是关闭消息包,则标识关闭类型,0:表示客户端主动关闭;1:服务端主动关闭;2:连接超时服务端主动关闭*/
|
||||
int64_t _recvTimeStamp; /**接收到数据的时间*/
|
||||
int64_t _recvTimeStamp; /**接收到数据的时间,微秒*/
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user