add timestamp.ml
WIP better time revert this?
This commit is contained in:
parent
d760a54b61
commit
d7d302bafa
10 changed files with 143 additions and 142 deletions
|
|
@ -58,39 +58,29 @@ module Bytes_64 = struct
|
|||
let bin = Bin.bytes 64
|
||||
end
|
||||
|
||||
(* microseconds since the UNIX Epoch
|
||||
UINT64_MAX represents "never" *)
|
||||
module INT64 = struct
|
||||
type t = int64
|
||||
|
||||
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 v = Util.ptime_to_int64 v
|
||||
let of_int64 i = i
|
||||
end
|
||||
|
||||
(* -- Time -- *)
|
||||
module type Time_S = sig
|
||||
type t
|
||||
type t = Timestamp.t
|
||||
|
||||
val bin : t Bin.t
|
||||
val of_ptime : Ptime.t -> t
|
||||
val of_int64 : int64 -> t
|
||||
end
|
||||
|
||||
module TimeAbsolute : Time_S = INT64
|
||||
module TimeAbsoluteNBO : Time_S = INT64_NBO
|
||||
module TimeRelative : Time_S = INT64
|
||||
module TimeRelativeNBO : Time_S = INT64_NBO
|
||||
module Timestamp : Time_S = INT64
|
||||
module TimestampNBO : Time_S = INT64_NBO
|
||||
module TIME : Time_S = struct
|
||||
type t = Timestamp.t
|
||||
|
||||
let bin = Timestamp.bin
|
||||
end
|
||||
|
||||
module TIME_NBO : Time_S = struct
|
||||
type t = Timestamp.t
|
||||
|
||||
let bin = Timestamp.bin_nbo
|
||||
end
|
||||
|
||||
module TimeAbsolute : Time_S = TIME
|
||||
module TimeAbsoluteNBO : Time_S = TIME_NBO
|
||||
module TimeRelative : Time_S = TIME
|
||||
module TimeRelativeNBO : Time_S = TIME_NBO
|
||||
|
||||
(* -- Cryptographic primitives -- *)
|
||||
|
||||
|
|
@ -238,6 +228,12 @@ end
|
|||
(* TODO keep this?
|
||||
some of those are actuall ecdhe, or union of eddsa|ecdhe *)
|
||||
module Aliases = struct
|
||||
module TimestampNBO : Time_S = struct
|
||||
type t = Timestamp.t
|
||||
|
||||
let bin = Timestamp.bin_nbo
|
||||
end
|
||||
|
||||
module AmountNBO = struct
|
||||
type t = Amount.t
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue