static_cast value to microsecond type (#73595)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73595

In some platforms, this might be a distinct type from 64-bit signed
integral, and the compiler might warn about implicit coercion.

Test Plan: Imported from OSS

Reviewed By: malfet

Differential Revision: D34558344

Pulled By: dagitses

fbshipit-source-id: 7a07d0723688390a7f27e6e71480d22c1e077200
(cherry picked from commit 8b807c4431f909c20b3133a6522b58d7b9ab0d85)
This commit is contained in:
mikey dagitses
2022-03-02 12:27:41 -08:00
committed by PyTorch MergeBot
parent 5dcc24963b
commit f087f1a3e6

View File

@ -893,7 +893,9 @@ void TCPClient::setTimeout(std::chrono::milliseconds value) {
static_cast<long>((value.count() % 1000) * 1000)};
#else
struct timeval timeoutTV = {
.tv_sec = value.count() / 1000, .tv_usec = (value.count() % 1000) * 1000};
.tv_sec = value.count() / 1000,
.tv_usec = static_cast<suseconds_t>((value.count() % 1000) * 1000),
};
#endif
SYSCHECK_ERR_RETURN_NEG1(::setsockopt(
socket_.handle(),