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

sys: timeutil: inconsistent types for local times #35380

Closed
JordanYates opened this issue May 18, 2021 · 2 comments
Closed

sys: timeutil: inconsistent types for local times #35380

JordanYates opened this issue May 18, 2021 · 2 comments
Assignees
Labels
area: API Changes to public APIs bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@JordanYates
Copy link
Collaborator

Describe the bug

The integer types for local times for timeutil conversion functions timeutil_sync_ref_from_local and timeutil_sync_local_from_ref are inconsistent. One presumes the local time is a signed 64bit integer, while the other assume an unsigned 64bit integer.

int timeutil_sync_ref_from_local(const struct timeutil_sync_state *tsp,
uint64_t local, uint64_t *refp);

int timeutil_sync_local_from_ref(const struct timeutil_sync_state *tsp,
uint64_t ref, int64_t *localp);

@JordanYates JordanYates added the bug The issue is a bug, or the PR is fixing a bug label May 18, 2021
@galak galak added priority: medium Medium impact/importance bug area: API Changes to public APIs labels May 18, 2021
@pabigot
Copy link
Collaborator

pabigot commented May 18, 2021

This is not a bug. Reference times are defined to be non-negative, hence an unsigned output from timeutil_sync_ref_from_local (negative reconstructed reference times result in a -ERANGE error return).

On the other hand a local time reconstructed from a reference time can be negative, if the reference time corresponds to an event that occurs before the system started.

I'll see if I can tweak the documentation so this is more clear.

@pabigot
Copy link
Collaborator

pabigot commented May 18, 2021

Actually that's already documented in the description:

An interpolated value before local time 0 is provided without error.

@pabigot pabigot closed this as completed May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants