Skip to content

Overflow in toAbsoluteTime #6

@leonpollak

Description

@leonpollak

Hello, dear developers.
I finally managed to compile OUTPOST and run my application under ARM and here start the problems...:-)
I am trying to wait for my queue for infinite duration.
What happens is that arriving to the function toAbsoluteTime with this infinity() duration, first is:
uint64_t nanoseconds = duration.microseconds() * 1000;
As the microseconds is the maximumValue number (9223372036854775807), nanoseconds becomes even more: 18,446,744,073,709,550,616 - don't know why, but this is the result gdb gives.
Thus the last operator:
absoluteTime.tv_sec += static_cast(nanoseconds / 1000000000);
tries to add more than 18billions which makes the result effectively negative(!).
Passing negative time to pthread_cond_timedwait() end it immediately, which obviously is not the desired result...:-)

I shall be very thankful for any comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions