-
Notifications
You must be signed in to change notification settings - Fork 77
Nanoseconds precision clocks : system and mono #249
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
Conversation
…han Unix.gettimeofday()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to add a type parameter to clocks to say what kind of time they return. That would allow having e.g. sys_clock : Ptime.t Clock.t
and mono_clock : Mtime.t Clock.t
.
Add sys_sleep_q for system clock sleep q Add mono_sleep_q for mono clock sleep q
…ng and luv backend
@talex5 This PR is ready for next round of reviews. I am working on moving some of the monotonic clock functionality to mtime. However, that will probably be another PR. |
Closing this in support of #308 |
This PR add two nanoseconds precision clocks to
eio
.The OSes supported are Linux, MacOS, BSDs and Windows (The CI is for MacOS and Windows will be another PR).
Additionally,
sleep_until
is now implemented using the given clock(either system or mono) and does not useUnix.gettimeofday
.The PR doesn't change the representation of time from
float
(fractional seconds) to minimize the diff. However, now that we can do nanoseconds precision, we could perhaps use nanoseconds as the default time measurement for the two clocks and provide a helper function to do nanoseconds to fractional seconds (as used by OCaml stdlib).At the moment we use
int64
to represent nanoseconds. I believe this is unboxed due to using @unboxed attribute in the external declaration. I didn't useOptint.t
sinceint64
is already unboxed.