Client: get timestamp in seconds
This commit is contained in:
parent
439435bd11
commit
ff4a5fadda
@ -52,12 +52,17 @@ let commands () =
|
|||||||
let open Clic in
|
let open Clic in
|
||||||
[
|
[
|
||||||
command ~group ~desc: "Access the timestamp of the block."
|
command ~group ~desc: "Access the timestamp of the block."
|
||||||
no_options
|
(args1
|
||||||
|
(switch ~doc:"output time in seconds" ~short:'s' ~long:"seconds" ()))
|
||||||
(fixed [ "get" ; "timestamp" ])
|
(fixed [ "get" ; "timestamp" ])
|
||||||
begin fun () (cctxt : Proto_alpha.full) ->
|
begin fun seconds (cctxt : Proto_alpha.full) ->
|
||||||
Block_services.timestamp
|
Block_services.timestamp
|
||||||
cctxt cctxt#block >>=? fun v ->
|
cctxt cctxt#block >>=? fun v ->
|
||||||
cctxt#message "%s" (Time.to_notation v) >>= fun () ->
|
begin
|
||||||
|
if seconds
|
||||||
|
then cctxt#message "%Ld" (Time.to_seconds v)
|
||||||
|
else cctxt#message "%s" (Time.to_notation v)
|
||||||
|
end >>= fun () ->
|
||||||
return ()
|
return ()
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user