zm::Select: Convert API to std::chrono

This commit is contained in:
Peter Keresztes Schmidt committed 2021-06-13 23:22:51 +02:00
1 parent c823b9c00e
commit 3e8b10d813
5 files changed
+9 -24

No files matched your search

+2 -14
View File
@@ -615,19 +615,7 @@ bool zm::TcpUnixServer::accept(TcpUnixSocket *&newSocket) {
return true;
}
void zm::Select::setTimeout(int timeout) {
mTimeout.tv_sec = timeout;
mTimeout.tv_usec = 0;
mHasTimeout = true;
}
void zm::Select::setTimeout(double timeout) {
mTimeout.tv_sec = int(timeout);
mTimeout.tv_usec = suseconds_t((timeout - mTimeout.tv_sec) * 1000000.0);
mHasTimeout = true;
}
void zm::Select::setTimeout(timeval timeout) {
void zm::Select::setTimeout(Microseconds timeout) {
mTimeout = timeout;
mHasTimeout = true;
}
@@ -703,7 +691,7 @@ void zm::Select::clearWriters() {
}
int zm::Select::wait() {
timeval tempTimeout = mTimeout;
timeval tempTimeout = zm::chrono::duration_cast<timeval>(mTimeout);
timeval *selectTimeout = mHasTimeout ? &tempTimeout : nullptr;
fd_set rfds;