add time.ml, similar to libgnunetutil's

This commit is contained in:
swrup 2026-02-05 15:31:49 +01:00 committed by Swrup
parent b507d540ad
commit 5392bafddf
17 changed files with 336 additions and 321 deletions

View file

@ -176,7 +176,7 @@ module Keys_post = struct
let* v = match opt with None -> error | Some v -> Ok v in
let check = function false -> error | true -> Ok () in
let* () =
check (Timestamp.compare v.stamp_start denom.stamp_start = Some 0)
check (Timestamp.compare v.stamp_start denom.stamp_start = 0)
in
let* () = check (v.value = denom.value) in
let* () = check (v.fee_refund = denom.fee_refund) in
@ -311,8 +311,7 @@ module Auditors = struct
Logs.info (fun m -> m "enabled auditor");
()
| Some last_date ->
let cmp = Timestamp.compare last_date validity_start |> Option.get in
if cmp > 0 then
if Timestamp.compare last_date validity_start > 0 then
Error
"database has more recent auditor data for this auditor public key"
else
@ -350,8 +349,7 @@ module Auditors_disable = struct
match last_date_opt with
| None -> Error "auditor not found"
| Some last_date ->
let cmp = Timestamp.compare last_date validity_end |> Option.get in
if cmp > 0 then
if Timestamp.compare last_date validity_end > 0 then
Error
"database has more recent auditor data for this auditor public key"
else
@ -452,7 +450,7 @@ module Global_fees = struct
} =
(* TODO KYC
what is kyc_timeout, kyc_fee ? *)
let kyc_timeout = None in
let kyc_timeout = Time.Relative.forever in
let kyc_fee = Amount.dummy_value in
(* * *)
let open Bin_sig.GlobalFees in
@ -562,7 +560,7 @@ module Wire = struct
| Some _ -> Error "wire already setup"
| None ->
(* TODO wire *)
let last_change = Ptime_clock.now () |> Option.some in
let last_change = Timestamp.of_ptime (Ptime_clock.now ()) in
let v =
ExchangeWireAccount.
{