From 117589e5c17bd3b9d1cc8ab532ec3278222a7f52 Mon Sep 17 00:00:00 2001 From: apb Date: Sun, 6 Jul 2014 20:50:03 +0000 Subject: [PATCH] When printing a timestamp to a metalog, use 9 digits for the nanoseconds part, except use only 1 digit if the value was zero. --- usr.bin/xinstall/xinstall.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 2dfcc0ad8d12..3f7a9c7e393e 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -1,4 +1,4 @@ -/* $NetBSD: xinstall.c,v 1.115 2011/09/06 18:50:32 joerg Exp $ */ +/* $NetBSD: xinstall.c,v 1.116 2014/07/06 20:50:03 apb Exp $ */ /* * Copyright (c) 1987, 1993 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ #if 0 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #else -__RCSID("$NetBSD: xinstall.c,v 1.115 2011/09/06 18:50:32 joerg Exp $"); +__RCSID("$NetBSD: xinstall.c,v 1.116 2014/07/06 20:50:03 apb Exp $"); #endif #endif /* not lint */ @@ -1202,8 +1202,10 @@ metadata_log(const char *path, const char *type, struct timeval *tv, if (*type == 'f') /* type=file */ fprintf(metafp, " size=%lld", (long long)size); if (tv != NULL && dopreserve) - fprintf(metafp, " time=%lld.%ld", - (long long)tv[1].tv_sec, (long)tv[1].tv_usec); + fprintf(metafp, " time=%lld.%0*ld", + (long long)tv[1].tv_sec, + (tv[1].tv_usec == 0 ? 1 : 9), + (long)tv[1].tv_usec); if (digestresult && digest) fprintf(metafp, " %s=%s", digest, digestresult); if (fflags)