diff --git a/.github/workflows/esy.yml b/.github/workflows/esy.yml index f5313b6..11f0d20 100644 --- a/.github/workflows/esy.yml +++ b/.github/workflows/esy.yml @@ -30,14 +30,10 @@ jobs: "dependencies": { "ocaml": "4.12.x", "@opam/mirage-clock": "*", - "@opam/mirage-clock-unix": "*", - "@opam/mirage-clock-solo5": "*", "reason-mobile": "github:EduardoRFS/reason-mobile:generate.json#7ba258319b87943d2eb0d8fb84562d0afeb2d41f" }, "resolutions": { "@opam/mirage-clock": "./mirage-clock.opam", - "@opam/mirage-clock-unix": "./mirage-clock-unix.opam", - "@opam/mirage-clock-solo5": "./mirage-clock-solo5.opam" } }' > esy.json diff --git a/appveyor.yml b/appveyor.yml index f6a3eb6..c03cfbb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,8 +6,8 @@ environment: FORK_BRANCH: master CYG_ROOT: C:\cygwin64 OPAM_SWITCH: 4.08.0+mingw64c - PINS: "mirage-clock.dev:. mirage-clock-unix.dev:." - PACKAGE: "mirage-clock-unix" + PINS: "mirage-clock.dev:." + PACKAGE: "mirage-clock" install: - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/$env:FORK_USER/ocaml-ci-scripts/$env:FORK_BRANCH/appveyor-install.ps1")) diff --git a/config/discover.ml b/config/discover.ml index 8e8f03d..f0bed21 100644 --- a/config/discover.ml +++ b/config/discover.ml @@ -1,7 +1,7 @@ module C = Configurator.V1 let () = - C.main ~name:"mirage-clock-unix" (fun c -> + C.main ~name:"mirage-clock" (fun c -> let is_android = let defines = C.C_define.import c ~includes:[] [ ("__ANDROID__", Switch) ] diff --git a/lib_test/dune b/lib_test/dune index 02f0a22..dd0ee15 100644 --- a/lib_test/dune +++ b/lib_test/dune @@ -1,4 +1,4 @@ (test (name portable) - (package mirage-clock-unix) - (libraries mirage-clock-unix)) + (package mirage-clock) + (libraries mirage-clock)) diff --git a/lib_test/portable.ml b/lib_test/portable.ml index f1e5944..656106a 100644 --- a/lib_test/portable.ml +++ b/lib_test/portable.ml @@ -1,3 +1,5 @@ +open Mirage_clock + let print_time c = let d, ps = Pclock.now_d_ps c in Printf.printf "The time is %d days and %Ld picoseconds since the epoch.\n" d diff --git a/solo5/dune b/solo5/dune index 9223bf4..6c04097 100644 --- a/solo5/dune +++ b/solo5/dune @@ -1,8 +1,7 @@ (library (name mirage_clock_solo5) - (wrapped false) - (public_name mirage-clock-solo5) - (libraries mirage-clock) + (public_name mirage-clock.solo5) + (implements mirage-clock) (foreign_stubs (language c) (names clock_stubs))) diff --git a/solo5/mclock.mli b/solo5/mclock.mli deleted file mode 100644 index fbbd0c2..0000000 --- a/solo5/mclock.mli +++ /dev/null @@ -1,22 +0,0 @@ -(* - * Copyright (c) 2015 Daniel C. Bünzli. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - *) - -(** Monotonic clock for MirageOS using paravirtual interfaces - - Clock returning monotonic time since an arbitrary point. To be used for eg. - profiling. *) - -include Mirage_clock.MCLOCK diff --git a/solo5/mirage_clock.ml b/solo5/mirage_clock.ml new file mode 100644 index 0000000..4afb665 --- /dev/null +++ b/solo5/mirage_clock.ml @@ -0,0 +1,2 @@ +module Pclock = Pclock +module Mclock = Mclock diff --git a/solo5/pclock.mli b/solo5/pclock.mli deleted file mode 100644 index bdef054..0000000 --- a/solo5/pclock.mli +++ /dev/null @@ -1,21 +0,0 @@ -(* - * Copyright (c) 2015 Daniel C. Bünzli - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - *) - -(** POSIX clock for MirageOS using paravirtual interfaces - - Clock counting time since the Unix epoch. Subject to adjustment by e.g. NTP. *) - -include Mirage_clock.PCLOCK diff --git a/src/dune b/src/dune index 5133e38..570cff5 100644 --- a/src/dune +++ b/src/dune @@ -1,3 +1,5 @@ (library (name mirage_clock) - (public_name mirage-clock)) + (public_name mirage-clock) + (virtual_modules mirage_clock) + (default_implementation mirage-clock.unix)) diff --git a/src/mirage_clock.ml b/src/mirage_clock.mli similarity index 97% rename from src/mirage_clock.ml rename to src/mirage_clock.mli index a2cfa25..f87f2b6 100644 --- a/src/mirage_clock.ml +++ b/src/mirage_clock.mli @@ -22,7 +22,7 @@ (** {2 POSIX clock} Clock counting time since the Unix epoch. Subject to adjustment by e.g. NTP. *) -module type PCLOCK = sig +module Pclock : sig val now_d_ps : unit -> int * int64 (** [now_d_ps ()] is [(d, ps)] representing the POSIX time occurring at [d] * 86'400e12 + [ps] POSIX picoseconds from the epoch 1970-01-01 00:00:00 UTC. @@ -43,7 +43,7 @@ end Clock returning monotonic time since an arbitrary point. To be used for e.g. profiling. *) -module type MCLOCK = sig +module Mclock : sig val elapsed_ns : unit -> int64 (** [elapsed_ns ()] is a monotonically increasing count of nanoseconds elapsed since some arbitrary point *) diff --git a/unix/dune b/unix/dune index e03be8e..877a2ca 100644 --- a/unix/dune +++ b/unix/dune @@ -1,8 +1,8 @@ (library (name mirage_clock_unix) - (wrapped false) - (public_name mirage-clock-unix) - (libraries mirage-clock unix) + (public_name mirage-clock.unix) + (implements mirage-clock) + (libraries unix) (foreign_stubs (language c) (flags diff --git a/unix/mclock.mli b/unix/mclock.mli deleted file mode 100644 index dab1720..0000000 --- a/unix/mclock.mli +++ /dev/null @@ -1,21 +0,0 @@ -(* - * Copyright (c) 2015 Daniel C. Bünzli. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - *) - -include Mirage_clock.MCLOCK -(** Monotonic clock for Unix using MirageOS interfaces - - Clock returning monotonic time since an arbitrary point. To be used for eg. - profiling. *) diff --git a/unix/mirage_clock.ml b/unix/mirage_clock.ml new file mode 100644 index 0000000..4afb665 --- /dev/null +++ b/unix/mirage_clock.ml @@ -0,0 +1,2 @@ +module Pclock = Pclock +module Mclock = Mclock diff --git a/unix/pclock.mli b/unix/pclock.mli deleted file mode 100644 index f01b8ee..0000000 --- a/unix/pclock.mli +++ /dev/null @@ -1,20 +0,0 @@ -(* - * Copyright (c) 2015 Daniel C. Bünzli - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - *) - -include Mirage_clock.PCLOCK -(** POSIX clock for MirageOS using Unix interfaces - - Clock counting time since the Unix epoch. Subject to adjustment by e.g. NTP. *)