Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sleep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void SleepForMicroseconds(int microseconds) {
}

void SleepForMilliseconds(int milliseconds) {
SleepForMicroseconds(static_cast<int>(milliseconds) * kNumMicrosPerMilli);
SleepForMicroseconds(static_cast<int>(milliseconds * kNumMicrosPerMilli));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

求问这句能解释下么XD

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

milliseconds is already an integer, it doesn't need to be casted to integer again. Instead, kNumMicrosPerMilli is a long, so after multiplication, it needs to be casted into int.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多谢哈 您在akuna么 我看到你的题解了XD 那里感觉如何哇

}

void SleepForSeconds(double seconds) {
Expand Down