Skip to content

Commit

Permalink
static_cast value to microsecond type (#73595)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch/pytorch#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)
  • Loading branch information
mikey dagitses authored and cyyever committed Mar 3, 2022
1 parent 3c89330 commit 12727be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion torch/csrc/distributed/c10d/TCPStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 12727be

Please sign in to comment.