This commit is contained in:
parent
f3de6ea80d
commit
576983481f
5 changed files with 109 additions and 12 deletions
|
|
@ -65,13 +65,15 @@ module INT64 = struct
|
|||
|
||||
let bin = Bin.neint64
|
||||
let of_ptime v = Util.ptime_to_int64 v
|
||||
let of_int64 i = i
|
||||
end
|
||||
|
||||
module INT64_NBO = struct
|
||||
type t = int64
|
||||
|
||||
let bin = Bin.beint64
|
||||
let of_ptime = Util.ptime_to_int64
|
||||
let of_ptime v = Util.ptime_to_int64 v
|
||||
let of_int64 i = i
|
||||
end
|
||||
|
||||
(* -- Time -- *)
|
||||
|
|
@ -80,6 +82,7 @@ module type Time_S = sig
|
|||
|
||||
val bin : t Bin.t
|
||||
val of_ptime : Ptime.t -> t
|
||||
val of_int64 : int64 -> t
|
||||
end
|
||||
|
||||
module TimeAbsolute : Time_S = INT64
|
||||
|
|
@ -262,22 +265,20 @@ module AmountP = struct
|
|||
currency: string;
|
||||
}
|
||||
|
||||
(* TODO BE here? *)
|
||||
let of_amount Amount.{ sign= _; currency; value; fraction } =
|
||||
{ value; fraction; currency }
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
record (fun value fraction currency -> { value; fraction; currency })
|
||||
|+ field beint64 (fun t -> t.value)
|
||||
|+ field beint32 (fun t -> t.fraction)
|
||||
|+ field neint64 (fun t -> t.value)
|
||||
|+ field neint32 (fun t -> t.fraction)
|
||||
|+ field (bytes currency_len) (fun t -> t.currency)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
module AmountNBO = struct
|
||||
type t = {
|
||||
value: int64;
|
||||
fraction: int32;
|
||||
currency: string;
|
||||
}
|
||||
include AmountP
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue