mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-28 09:18:52 -04:00
Buffer: Convert API to std::chrono
This commit is contained in:
1 parent
707975e567
commit
c823b9c00e
2 files changed
+7
-3
No files matched your search
+5
-2
@@ -74,11 +74,13 @@ int Buffer::read_into(int sd, unsigned int bytes) {
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
int Buffer::read_into(int sd, unsigned int bytes, struct timeval timeout) {
|
||||
int Buffer::read_into(int sd, unsigned int bytes, Microseconds timeout) {
|
||||
fd_set set;
|
||||
FD_ZERO(&set); /* clear the set */
|
||||
FD_SET(sd, &set); /* add our file descriptor to the set */
|
||||
int rv = select(sd + 1, &set, NULL, NULL, &timeout);
|
||||
timeval timeout_tv = zm::chrono::duration_cast<timeval>(timeout);
|
||||
|
||||
int rv = select(sd + 1, &set, nullptr, nullptr, &timeout_tv);
|
||||
if (rv == -1) {
|
||||
Error("Error %d %s from select", errno, strerror(errno));
|
||||
return rv;
|
||||
@@ -86,5 +88,6 @@ int Buffer::read_into(int sd, unsigned int bytes, struct timeval timeout) {
|
||||
Debug(1, "timeout"); /* a timeout occured */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return read_into(sd, bytes);
|
||||
}
|
||||
Reference in new issue
Block a user