[libvirt] [PATCH 1/2] util: Add helper function to build timestamp string

Eric Blake eblake at redhat.com
Mon Nov 1 23:10:58 UTC 2010


On 10/31/2010 10:17 PM, Osier Yang wrote:
> * src/util/util.h
> * src/util/util.c
> * src/libvirt_private.syms
> ---
>  src/libvirt_private.syms |    1 +
>  src/util/util.c          |   20 ++++++++++++++++++++
>  src/util/util.h          |    3 +++
>  3 files changed, 24 insertions(+), 0 deletions(-)
> 
> +
> +char *virTimestamp(void) {

We typically start functions with the { on the first column of a new line.

> +    if (virAsprintf(&timestamp, "%s.%3d: ",
> +                    timestr, (int) cur_time.tv_usec / 1000) < 0) {

You want %03d, to ensure that you always print 3 digits of fractional
seconds, even when < 100.

ACK with those nits adjusted; I made the changes and pushed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101101/faff831b/attachment-0001.sig>


More information about the libvir-list mailing list