From: Jérémie D. <Ba...@us...> - 2011-03-30 22:06:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 42761a095b9fe25b724642b4252134dc57aae150 (commit) from 8da6a52789fe20e2768f07d5e0fa4e3ea623f90e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 42761a095b9fe25b724642b4252134dc57aae150 Author: Jérémie Dimino <je...@di...> Date: Thu Mar 31 00:05:32 2011 +0200 [krobot_dump] display better timestamps ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_dump.ml b/info/control2011/src/tools/krobot_dump.ml index c8c9f39..2aeca8a 100644 --- a/info/control2011/src/tools/krobot_dump.ml +++ b/info/control2011/src/tools/krobot_dump.ml @@ -24,6 +24,33 @@ let usage = "\ Usage: krobot-dump [options] options are:" +let date_string time = + let tm = Unix.localtime time in + let month_string = + match tm.Unix.tm_mon with + | 0 -> "Jan" + | 1 -> "Feb" + | 2 -> "Mar" + | 3 -> "Apr" + | 4 -> "May" + | 5 -> "Jun" + | 6 -> "Jul" + | 7 -> "Aug" + | 8 -> "Sep" + | 9 -> "Oct" + | 10 -> "Nov" + | 11 -> "Dec" + | _ -> Printf.ksprintf failwith "Lwt_log.ascdate: invalid month, %d" tm.Unix.tm_mon + in + Printf.sprintf + "%s %2d %02d:%02d:%02d.%s" + month_string + tm.Unix.tm_mday + tm.Unix.tm_hour + tm.Unix.tm_min + tm.Unix.tm_sec + (String.sub (Printf.sprintf "%.4f" (fst (modf time))) 2 4) + lwt () = Arg.parse options ignore usage; @@ -33,16 +60,16 @@ lwt () = (E.map_s (fun (timestamp, frame) -> let msg = Krobot_message.decode frame in - lwt () = Lwt_io.printf "%f" timestamp in + lwt () = Lwt_io.print (date_string timestamp)in lwt () = if !decoded then - Lwt_io.printf ", %s" (Krobot_message.to_string msg) + Lwt_io.printf ": %s" (Krobot_message.to_string msg) else return () in lwt () = if !raw then - Lwt_io.printf ", %s" (Krobot_can.string_of_frame frame) + Lwt_io.printf ": %s" (Krobot_can.string_of_frame frame) else return () in hooks/post-receive -- krobot |