-
Notifications
You must be signed in to change notification settings - Fork 284
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
IH-628: Add new package for timekeeping #5724
Conversation
a03a775
to
59d46e6
Compare
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.
LGTM, would be good to see how this package is used in xapi
b59aa62
to
d2ad74f
Compare
|
||
val span_to_s : Mtime.Span.t -> float | ||
(** [span_to_s span] converts a time span into seconds, represented by a float. | ||
When the span is longer than ~55 years, rounding errors appear. Avoid |
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.
Should we add a limit here to 253 nanoseconds using an option? This would make the conversions symmetric in that respect, and we can treat the error at the caller of the RPC function, and not the callee end.
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.
I have seen the case float -> span -> float
for config parsing.
For RPC, it might be that we encounter the case span -> float -> span
, so we need to be wary about those. I'll take care of these conversions when I change them.
e4e548a
to
b3810bb
Compare
Signed-off-by: Pau Ruiz Safont <[email protected]>
It currently duplicates the date module from stdext, dropping the deprecated bindings Signed-off-by: Pau Ruiz Safont <[email protected]>
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.
One small change in Dune and rounding, and then it passes the quickcheck on the epoll PR.
(I haven't rebased the entire PR yet, but if the tests pass then the rest should work too)
84b0bca
to
c8fff10
Compare
Signed-off-by: Pau Ruiz Safont <[email protected]>
This module can be used to know when a certain amount has passed since the timer started by polling. Useful for encoding timeouts, schedule actions periodically and similar. Signed-off-by: Pau Ruiz Safont <[email protected]>
These could help with the porting of the redo_log code, but Edwin's has working code that changes the API of the timed calls to use durations instead of deadlines. Signed-off-by: Pau Ruiz Safont <[email protected]>
Because the debug module doesn't use best practices, pretty-printers using the Format module are not ergonomic to use when they are needed for constructing loglines. Provide a module for adapters, containing Mtime's spans for the time being. Signed-off-by: Pau Ruiz Safont <[email protected]>
This allows to define in the code the exact amount of time, including the measure of time used as base. This is usually minutes. On top of that it allows for two type of configuration parameters: one that retains backwards compatibility, using seconds as floats. They can be used to define relatively short amounts of time (less that 104 days). For longer amounts of time, seconds can be encoded as integers. When printing the configuration, both the literal value used to configure the global and the amount using time units is shown. Signed-off-by: Pau Ruiz Safont <[email protected]>
Signed-off-by: Pau Ruiz Safont <[email protected]>
c8fff10
to
d75ded9
Compare
Moves Date to be implemented here, without the deprecated functions, and adds the timer module, which should be enough to satisfy the various efforts needing timers
Draft because Tests are missing