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

set_time_of_day does not set monotonic time value #34

Open
michaeljones opened this issue Jun 25, 2024 · 1 comment
Open

set_time_of_day does not set monotonic time value #34

michaeljones opened this issue Jun 25, 2024 · 1 comment

Comments

@michaeljones
Copy link
Contributor

I came across an issue where I tried to do:

let now = birl.now()
let start_time =
  birl.set_time_of_day(
    now,
    birl.TimeOfDay(hour: 8, minute: 0, second: 0, milli_second: 0),
  )
let diff = birl.difference(now, start_time)

But this always returns Duration(0) because set_time_of_day doesn't seem to change the monotonic_time and difference uses the monotonic_time if it can?

I'm afraid I'm not sure what the solution is. Possibly to set the monotonic time to None if it is not possible to calculate it from the new time of day.

I have worked around it by converting now to an iso8601 string and re-parsing it at which point it doesn't have a monotonic_time so the approach works.

@massivefermion
Copy link
Owner

Right now the monotonic time is just the time passed since the VM started. To implement this I should change it so that the momotonic time also indicates a specific moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants