From ff4a5faddae014bdcfb2378ae863f0666a4d6f70 Mon Sep 17 00:00:00 2001 From: Milo Davis Date: Mon, 23 Apr 2018 17:25:36 -0400 Subject: [PATCH] Client: get timestamp in seconds --- .../client_proto_context_commands.ml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index 27b1429e2..88f47989c 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -52,12 +52,17 @@ let commands () = let open Clic in [ 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" ]) - begin fun () (cctxt : Proto_alpha.full) -> + begin fun seconds (cctxt : Proto_alpha.full) -> Block_services.timestamp 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 () end ;