-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FOGL-9183: Round of the microseconds to seconds for time difference #93
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: nandan <[email protected]>
@gnandan better to change the base to 2.6.0RC if all good. /cc @ashish-jabble @Mohit04tomar |
…in seconds Signed-off-by: nandan <[email protected]>
@@ -780,6 +780,13 @@ bool NotificationInstance::handleState(bool evalRet) | |||
// Calculate time diff | |||
timersub(&now_tv, &m_lastSentTv, &diffTimeTv); | |||
|
|||
// round up the seconds If microseconds are greater than or equal to 500000 | |||
if (diffTimeTv.tv_usec >= 500000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if define it as const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think, i fully understand the rationality of the logic here. What is the need to look into lower order precision (micros second) ? to override, high order precision ? Does our need to have time precision of 500 milli second ..?
I think it is better if we stick with the time precisions.
I see we are using gettimeofday() here are some resons we should not use it https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time.html
Here the example code with custom precision.
auto start = std::chrono::steady_clock::now();
// Perform some operations
for (int i = 0; i < 1000000; ++i);
auto end = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is very debatable as to if the issue raised is a real problem. I would be very tempted to say we do not include this and close the original Jira as not a problem.
No description provided.