This commit is contained in:
swrup 2026-02-23 11:13:54 +01:00
parent b57e9cfa73
commit 1b4fba3216
3 changed files with 7 additions and 9 deletions

View file

@ -60,16 +60,10 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date =
let zero_limits = [] in let zero_limits = [] in
let* denom_l = Keys.denominations () in let* denom_l = Keys.denominations () in
let denom_l =
(* reverse chronological order *)
List.sort
(fun a b -> Stdlib.compare b.Denomination.stamp_start a.stamp_start)
denom_l
in
let list_issue_date = let list_issue_date =
match denom_l with List.fold_left
| [] -> Timestamp.zero (fun acc dn -> Timestamp.max acc dn.Denomination.stamp_start)
| dn :: _ -> dn.Denomination.stamp_start Timestamp.zero denom_l
in in
let denom_l = let denom_l =
(* if `?last_issue_date` query param does not exactly match the `stamp_start` (* if `?last_issue_date` query param does not exactly match the `stamp_start`

View file

@ -99,6 +99,8 @@ module Timestamp = struct
let never = uint64_max let never = uint64_max
let zero = 0L let zero = 0L
let compare = Int64.unsigned_compare let compare = Int64.unsigned_compare
let min a b = if compare a b < 0 then a else b
let max a b = if compare a b > 0 then a else b
(* zero if a >= b; never if b=never; otherwise b - a *) (* zero if a >= b; never if b=never; otherwise b - a *)
let diff a b = let diff a b =

View file

@ -38,6 +38,8 @@ module Timestamp : sig
val never : t val never : t
val zero : t val zero : t
val compare : t -> t -> int val compare : t -> t -> int
val min : t -> t -> t
val max : t -> t -> t
val diff : t -> t -> Relative.t val diff : t -> t -> Relative.t
val of_s : int64 -> t val of_s : int64 -> t