[Libguestfs] [PATCH] mllib: use Unix.gettimeofday instead of Unix.time
Richard W.M. Jones
rjones at redhat.com
Wed Jun 3 17:48:42 UTC 2015
On Wed, Jun 03, 2015 at 04:22:07PM +0200, Pino Toscano wrote:
> Unix.gettimeofday returns a finer resolution than seconds, which is what
> we need since deciseconds of timestamps are printed.
> ---
> mllib/common_utils.ml | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
> index 32e908d..516cff3 100644
> --- a/mllib/common_utils.ml
> +++ b/mllib/common_utils.ml
> @@ -282,11 +282,11 @@ let verbose () = !verbose
> (* Timestamped progress messages, used for ordinary messages when not
> * --quiet.
> *)
> -let start_t = Unix.time ()
> +let start_t = Unix.gettimeofday ()
> let message fs =
> let display str =
> if not (quiet ()) then (
> - let t = sprintf "%.1f" (Unix.time () -. start_t) in
> + let t = sprintf "%.1f" (Unix.gettimeofday () -. start_t) in
> printf "[%6s] " t;
> ansi_green ();
> printf "%s" str;
> --
> 2.1.0
Yes indeed ... ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs
mailing list