RPC: allow 'epoch' as a valid Time.rpc_arg
This commit is contained in:
parent
d3f4424c75
commit
3ba30fa468
@ -113,10 +113,18 @@ module T = struct
|
|||||||
~descr:(Format.asprintf "A date in seconds from epoch")
|
~descr:(Format.asprintf "A date in seconds from epoch")
|
||||||
~destruct:
|
~destruct:
|
||||||
(fun s ->
|
(fun s ->
|
||||||
match Int64.of_string s with
|
if s = "none" || s = "epoch" then
|
||||||
| exception _ ->
|
Ok epoch
|
||||||
Error (Format.asprintf "failed to parse time (epoch): %S" s)
|
else
|
||||||
| v -> Ok v)
|
match of_notation s with
|
||||||
|
| None -> begin
|
||||||
|
match Int64.of_string s with
|
||||||
|
| exception _ -> begin
|
||||||
|
Error (Format.asprintf "failed to parse time (epoch): %S" s)
|
||||||
|
end
|
||||||
|
| t -> Ok t
|
||||||
|
end
|
||||||
|
| Some t -> Ok t)
|
||||||
~construct:Int64.to_string
|
~construct:Int64.to_string
|
||||||
()
|
()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user