Conversation
|
|
||
| (** Timeout operations. *) | ||
|
|
||
| val sleep : float -> unit Lwt.t |
There was a problem hiding this comment.
Why is this being removed? It's OK to add a new function if we need to, but removing the old one serves no purpose.
There was a problem hiding this comment.
(Thought part of the point of this was to remove need for floats?)
On 29 June 2016 at 14:04, Thomas Leonard notifications@github.com wrote:
In unix/lib/time.mli
#168 (comment):@@ -18,6 +18,6 @@ type +'a io = 'a Lwt.t
(** Timeout operations. *)
-val sleep : float -> unit Lwt.t
Why is this being removed? It's OK to add a new function if we need to,
but removing the old one serves no purpose.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mirage/mirage-platform/pull/168/files/d03e97408093e46d4f779db72c2be0f1b878f770#r68941502,
or mute the thread
https://github.com/notifications/unsubscribe/AAKP4KhO7u6JvbYTJqSelXadRiPhqlvYks5qQm14gaJpZM4JBE6e
.
Richard Mortier
mort@cantab.net
There was a problem hiding this comment.
@talex5 what is the purpose of keeping the function? my impression was that mirage-unix/xen is an implementation of (some of the modules defined in) mirage-types...
There was a problem hiding this comment.
- It's used in lots of places and there's no need to break everything.
- OCaml uses floats to represent times, so having something that accepts OCaml times is useful.
- Using floats allows representing very long or short durations without errors.
- Using floats avoids error-prone scaling (e.g. all the
* 1_000_000_000magic constants in the recent patches). - Using floats avoids overflow errors when converting between timebases (e.g.
duration_at_freq_1 /. freq_1 *. freq_2works; usingint64might not, depending on the frequencies and duration).
In general, it's conveniet, familiar and safe. So for code that doesn't care about performance, I'd prefer to stick to floats.
There was a problem hiding this comment.
I just wrote up a durations library for easy conversion from your favourite time representation (microseconds, milliseconds, seconds, minutes, hours, years as int), seconds as floating point number) to nanoseconds (and the inverse). A uint64 representing nanoseconds allows for a range up to 584 years, that should be sufficient for sleep durations.
IMHO OCaml uses floats is a mistake (and the queued changes to PCLOCK/MCLOCK inside of mirage-types will get rid of this mistake inside of mirage).
a844d58 Merge pull request mirage#176 from JuliaLang/aa/openbsd 72bfab4 Avoid redefining macros defined by the system 48c6c2c Use cp -RpP instead of cp -a bf188ae Build with Clang on OpenBSD b7b3b4b Merge pull request mirage#175 from takuyanakaoka/fix-sincosl d134c84 Fix reversed outputs of sincosl c99ab08 Merge pull request mirage#173 from pkofod/patch-1 3db5e54 Minor typo in expm1 comment b252047 Merge pull request mirage#168 from JuliaLang/yyc/ld128 238a909 Fix compilation on AArch64 3ff5216 Merge pull request mirage#162 from JuliaLang/aa/0.5.5 7cf4e9e Merge pull request mirage#164 from iblis17/test-cflags bd6d0e1 test: update ulps for yn 400407e test: append $(CFLAGS_add), which includes fno-builtin ddf649b enable -fno-strict-aliasing for clang (mirage#156) c3968ca Allow building on DragonFly BSD (mirage#167) 7e726c3 Bump version to 0.5.5 b11e72b Set the RPATH for the test binaries on FreeBSD (mirage#161) git-subtree-dir: openlibm git-subtree-split: a844d584d36fcb117c7880d87b806ff84b20f378
Requires mirage/mirage#547 .