mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28: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-branch-clone,
|
||||||
bugprone-implicit-widening-of-multiplication-result,
|
bugprone-implicit-widening-of-multiplication-result,
|
||||||
bugprone-incorrect-division,
|
bugprone-incorrect-division,
|
||||||
|
bugprone-incorrect-roundings,
|
||||||
]
|
]
|
||||||
|
|
|
@ -1875,9 +1875,9 @@ double current_time(bool real) {
|
||||||
struct timeval double_to_timeval(double t) {
|
struct timeval double_to_timeval(double t) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
double t1 = floor(t);
|
double t1 = std::floor(t);
|
||||||
tv.tv_sec = int(t1);
|
tv.tv_sec = static_cast<time_t>(t1);
|
||||||
tv.tv_usec = int((t - t1) * 1e6 + 0.5);
|
tv.tv_usec = std::lround((t - t1) * 1e6);
|
||||||
|
|
||||||
return tv;
|
return tv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue