wip pg.ml

This commit is contained in:
swrup 2025-11-16 05:33:06 +01:00
parent c48892ca9a
commit 2433ff3932
3 changed files with 56 additions and 9 deletions

View file

@ -9,7 +9,12 @@ end
(* -- Ptime -- *)
let ptime_to_int64_us p = Int64.of_float (1_000_000. *. Ptime.to_float_s p)
let ptime_to_int64 ptime = ptime |> Ptime.to_float_s |> Int64.of_float
let ptime_of_int64 i =
match Ptime.of_float_s (Int64.to_float i) with
| None -> Fmt.error "ptime_of_int64 error: `%Ld` is not a valid ptime" i
| Some ts -> Ok ts
let ptime_of_span_exn span =
match Ptime.of_span span with