https://github.com/codiepp/ml-cpp-chrono
OCaml embedded cross-platform C++ <chrono>
https://github.com/codiepp/ml-cpp-chrono
chrono cpp hacktoberfest ocaml
Last synced: 17 days ago
JSON representation
OCaml embedded cross-platform C++ <chrono>
- Host: GitHub
- URL: https://github.com/codiepp/ml-cpp-chrono
- Owner: CodiePP
- License: apache-2.0
- Created: 2022-09-03T11:23:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-17T19:00:24.000Z (about 3 years ago)
- Last Synced: 2025-10-25T14:40:42.573Z (7 months ago)
- Topics: chrono, cpp, hacktoberfest, ocaml
- Language: C++
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ml-cpp-chrono
OCaml embedded cross-platform C++ <[chrono](https://en.cppreference.com/w/cpp/chrono)>
## build it
`dune build`
## run the demo
`dune exec mlCppChrono`
## run the tests
`dune runtest`
## the interface
```OCaml
type duration
module Duration :
sig
val to_string : duration -> string
val to_int : duration -> int
(* TODO val ticks : duration -> float *)
val int_to_ns : int -> duration
val int_to_ms : int -> duration
val int_to_s : int -> duration
val int_to_m : int -> duration
val int_to_h : int -> duration
val int_to_d : int -> duration
val int_to_w : int -> duration
val cast_ns : duration -> duration
val cast_ms : duration -> duration
val cast_s : duration -> duration
val cast_m : duration -> duration
val cast_h : duration -> duration
val cast_d : duration -> duration
val cast_w : duration -> duration
val eq : duration -> duration -> bool
val lt : duration -> duration -> bool
val le : duration -> duration -> bool
val gt : duration -> duration -> bool
val ge : duration -> duration -> bool
val add : duration -> duration -> duration
end
module Clock :
sig
module type CLOCK =
sig
type timepoint
val now : unit -> timepoint
val to_sys_time : timepoint -> float
(* compatible with Unix.time : seconds since 00:00 Jan-1 1970 *)
val diff : timepoint -> timepoint -> duration
(* returns the duration in nanoseconds *)
end
module System : CLOCK
module Steady : CLOCK
module Hires : CLOCK
end (* Clock *)
```