mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix clang-tidy bugprone-incorrect-roundings warnings
This commit is contained in:
parent
87f1b1a7b3
commit
1d315a3847
2 changed files with 4 additions and 3 deletions
|
@ -3,4 +3,5 @@ Checks: [-*,
|
|||
bugprone-branch-clone,
|
||||
bugprone-implicit-widening-of-multiplication-result,
|
||||
bugprone-incorrect-division,
|
||||
bugprone-incorrect-roundings,
|
||||
]
|
||||
|
|
|
@ -1875,9 +1875,9 @@ double current_time(bool real) {
|
|||
struct timeval double_to_timeval(double t) {
|
||||
struct timeval tv;
|
||||
|
||||
double t1 = floor(t);
|
||||
tv.tv_sec = int(t1);
|
||||
tv.tv_usec = int((t - t1) * 1e6 + 0.5);
|
||||
double t1 = std::floor(t);
|
||||
tv.tv_sec = static_cast<time_t>(t1);
|
||||
tv.tv_usec = std::lround((t - t1) * 1e6);
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue