Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses __CTRACE - don't call gettimeofday() twice.



details:   https://anonhg.NetBSD.org/src/rev/98c9b2786665
branches:  trunk
changeset: 445432:98c9b2786665
user:      uwe <uwe%NetBSD.org@localhost>
date:      Mon Oct 29 00:31:57 2018 +0000

description:
__CTRACE - don't call gettimeofday() twice.

diffstat:

 lib/libcurses/ctrace.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 19afc97c6a14 -r 98c9b2786665 lib/libcurses/ctrace.c
--- a/lib/libcurses/ctrace.c    Mon Oct 29 00:25:20 2018 +0000
+++ b/lib/libcurses/ctrace.c    Mon Oct 29 00:31:57 2018 +0000
@@ -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 @@
 void
 __CTRACE(int area, const char *fmt,...)
 {
-       struct timeval tv;
         static int seencr = 1;
        va_list ap;
 
@@ -93,8 +92,9 @@
                __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);



Home | Main Index | Thread Index | Old Index