This commit is contained in:
parent
b57e9cfa73
commit
1b4fba3216
3 changed files with 7 additions and 9 deletions
|
|
@ -60,16 +60,10 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date =
|
|||
let zero_limits = [] 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 =
|
||||
match denom_l with
|
||||
| [] -> Timestamp.zero
|
||||
| dn :: _ -> dn.Denomination.stamp_start
|
||||
List.fold_left
|
||||
(fun acc dn -> Timestamp.max acc dn.Denomination.stamp_start)
|
||||
Timestamp.zero denom_l
|
||||
in
|
||||
let denom_l =
|
||||
(* if `?last_issue_date` query param does not exactly match the `stamp_start`
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ module Timestamp = struct
|
|||
let never = uint64_max
|
||||
let zero = 0L
|
||||
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 *)
|
||||
let diff a b =
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ module Timestamp : sig
|
|||
val never : t
|
||||
val zero : t
|
||||
val compare : t -> t -> int
|
||||
val min : t -> t -> t
|
||||
val max : t -> t -> t
|
||||
val diff : t -> t -> Relative.t
|
||||
val of_s : int64 -> t
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue