add timestamps; use Ptime
This commit is contained in:
parent
112ece6d9a
commit
a27af0ecf1
8 changed files with 163 additions and 77 deletions
23
src/types.ml
23
src/types.ml
|
|
@ -16,15 +16,15 @@ module Config_types = struct
|
|||
(* section_name: Name in the configuration file that defines this denomination *)
|
||||
section_name: string;
|
||||
value: Amount.t;
|
||||
duration_withdraw: int;
|
||||
duration_spend: int;
|
||||
duration_legal: int;
|
||||
duration_withdraw: Ptime.Span.t;
|
||||
duration_spend: Ptime.Span.t;
|
||||
duration_legal: Ptime.Span.t;
|
||||
fee_withdraw: Amount.t;
|
||||
fee_deposit: Amount.t;
|
||||
fee_refresh: Amount.t;
|
||||
fee_refund: Amount.t;
|
||||
cipher: [ (* `CS |*) `RSA ];
|
||||
rsa_keysize: int option (*only if `RSA *);
|
||||
rsa_keysize: int; (* : int option (only if `RSA) *)
|
||||
age_restricted: [ (*`YES|*) `NO ];
|
||||
}
|
||||
end
|
||||
|
|
@ -43,20 +43,21 @@ end
|
|||
(* TODO number
|
||||
- number is "float", but we probably want int everywhere instead
|
||||
- numeric values capped at 2^53 -1 inclusive because json
|
||||
- have a type for seconds/microseconds/..? *)
|
||||
*)
|
||||
|
||||
(* TODO time
|
||||
- int64 instead of float/int (binary format time in int64 us)
|
||||
? make api types take in Ptime.t instead of Timestamp.t
|
||||
? issues with "never" = uint64_max *)
|
||||
module Timestamp = struct
|
||||
(* Seconds since epoch, or the special
|
||||
value "never" to represent an event that will
|
||||
never happen. *)
|
||||
type t =
|
||||
| Seconds of float
|
||||
| Never
|
||||
|
||||
let of_ptime p = Seconds (Ptime.to_float_s p)
|
||||
end
|
||||
|
||||
module RelativeTime = struct
|
||||
(* Duration in microseconds or "forever"
|
||||
to represent an infinite duration. Numeric
|
||||
values are capped at 2^53 - 1 inclusive. *)
|
||||
type t =
|
||||
| Microseconds of float
|
||||
| Forever
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue