__CTRACE - don't call gettimeofday() twice.

This commit is contained in:
uwe 2018-10-29 00:31:57 +00:00
parent d05568e5ff
commit 8c2d3cb78d

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctrace.c,v 1.22 2018/10/29 00:25:20 uwe Exp $ */
/* $NetBSD: ctrace.c,v 1.23 2018/10/29 00:31:57 uwe Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93";
#else
__RCSID("$NetBSD: ctrace.c,v 1.22 2018/10/29 00:25:20 uwe Exp $");
__RCSID("$NetBSD: ctrace.c,v 1.23 2018/10/29 00:31:57 uwe Exp $");
#endif
#endif /* not lint */
@ -85,7 +85,6 @@ __CTRACE_init(void)
void
__CTRACE(int area, const char *fmt,...)
{
struct timeval tv;
static int seencr = 1;
va_list ap;
@ -93,8 +92,9 @@ __CTRACE(int area, const char *fmt,...)
__CTRACE_init();
if (tracefp == NULL || !(tracemask & area))
return;
gettimeofday(&tv, NULL);
if (seencr && (tracemask & __CTRACE_TSTAMP)) {
struct timeval tv;
gettimeofday(&tv, NULL);
(void)fprintf(tracefp, "%llu.%06lu: ",
(long long)tv.tv_sec, (long)tv.tv_usec);