Skip to content
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

nanoseconds in units::Duration are truncated #190

Closed
dkroenke opened this issue Jul 13, 2020 · 2 comments · Fixed by #501
Closed

nanoseconds in units::Duration are truncated #190

dkroenke opened this issue Jul 13, 2020 · 2 comments · Fixed by #501
Assignees
Labels
bug Something isn't working

Comments

@dkroenke
Copy link
Member

Required information

Operating system:
on aarch64 targets like Raspberry PI

Compiler version:
E.g. GCC 9.3.0

Observed result or behaviour:
The Posix Timer is getting double values on the API which are then converted into int64_t internally. This conversion leads to a loss of data because the compiler will truncate the value. This can lead to abnormal behaviour when using small numbers like 1 nanoseconds.

Expected result or behaviour:
Remove the double literals from the posix timer API and expect only integer als time values. Then we avoid this constraint and have a clean calculation.

Conditions where it occurred / Performed steps:
Try to start a timer with 1 nanosecond waiting time. It will no execute because the time is internally set to zero. This disarms the timer and it is not proceeding.

@dkroenke dkroenke added the bug Something isn't working label Jul 13, 2020
@marthtz marthtz mentioned this issue Nov 5, 2020
4 tasks
@budrus
Copy link
Contributor

budrus commented Nov 20, 2020

I can confirm. But first lost some time with my Pi before finding this issue...

@elBoberido
Copy link
Member

@dkroenke I think this related to the underlying long double of units::Duration. Should we rephrase this bug to fix the problem on its source?

@elfenpiff suggested in #337 to use

struct duration_t {
     uint64_t seconds;
     uint32_t nanoseconds;
};

as base instead of long double

@dkroenke dkroenke changed the title posix timer values are truncated nanoseconds in units::Duration are truncated Jan 15, 2021
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 16, 2021
…ong double from user defined literals

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 16, 2021
…presentation

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 16, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 16, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
@elBoberido elBoberido added this to To do in v1.0 via automation Jan 18, 2021
@elBoberido elBoberido added this to To do in Sprints via automation Jan 18, 2021
@elBoberido elBoberido moved this from To do to In progress in Sprints Jan 18, 2021
@elBoberido elBoberido self-assigned this Jan 18, 2021
@elBoberido elBoberido moved this from In progress to Review in Sprints Jan 18, 2021
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
…ue to negative values

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
…tion

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
…ue to negative values

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
…tion

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 19, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 21, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 21, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 21, 2021
…conds conversion with clamping to max value

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 22, 2021
…ong double from user defined literals

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
… to max value

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
…for Duration

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
…s with additional overflow handling

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
…tion

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
…ype alias

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
…t multiplication

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido pushed a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
…ctor to circumvent windows build issue

Signed-off-by: Christian Eltzschig <me@elchris.org>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 27, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 29, 2021
… in 0 Duration

Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Jan 29, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Feb 1, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Feb 1, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido added a commit to ApexAI/iceoryx that referenced this issue Feb 1, 2021
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
v1.0 automation moved this from To do to Done Feb 1, 2021
Sprints automation moved this from Review to Done Feb 1, 2021
elBoberido added a commit that referenced this issue Feb 1, 2021
…ation-internal-representation

Iox #190 fixed point types for duration internal representation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
v1.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants