Skip to content

Commit 767bcb7

Browse files
committed
FOGL-9183: Round of the microseconds to seconds for time difference
Signed-off-by: nandan <[email protected]>
1 parent ab67f9b commit 767bcb7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

C/services/notification/notification_manager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,13 @@ bool NotificationInstance::handleState(bool evalRet)
780780
// Calculate time diff
781781
timersub(&now_tv, &m_lastSentTv, &diffTimeTv);
782782

783+
// round up the seconds If microseconds are greater than or equal to 500000
784+
if (diffTimeTv.tv_usec >= 500000)
785+
{
786+
diffTimeTv.tv_sec = diffTimeTv.tv_sec + 1;
787+
diffTimeTv.tv_usec = 0;
788+
}
789+
783790
switch(nType.type)
784791
{
785792
case NotificationInstance::OneShot:

0 commit comments

Comments
 (0)