/****************************************************************************
- * Copyright 2018-2021,2022 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.532 2022/12/04 00:40:11 tom Exp $
+$Id: ncurses.c,v 1.534 2023/02/25 19:30:27 tom Exp $
***************************************************************************/
+#define NEED_TIME_H 1
#include <test.priv.h>
#ifdef __hpux
#undef mvwdelch /* HPUX 11.23 macro will not compile */
#endif
-#if HAVE_GETTIMEOFDAY
#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT
#include <sys/time.h>
#endif
+
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#endif
#if USE_LIBPANEL
#include <panel.h>
int (*pgetc) (WINDOW *),
bool colored)
{
-#if HAVE_GETTIMEOFDAY
- struct timeval before, after;
+ TimeType before, after;
bool timing = TRUE;
-#endif
bool pan_lines = FALSE;
bool scrollers = TRUE;
int basex = 0;
pending_pan = FALSE;
break;
-#if HAVE_GETTIMEOFDAY
case 't':
timing = !timing;
if (!timing)
panner_legend(LINES - 1);
break;
-#endif
case 's':
scrollers = !scrollers;
break;
MvAddCh(porty - 1, portx - 1, ACS_LRCORNER);
if (!pending_pan) {
-#if HAVE_GETTIMEOFDAY
- gettimeofday(&before, 0);
-#endif
+ GetClockTime(&before);
wnoutrefresh(stdscr);
pnoutrefresh(pad,
portx - (pymax > porty) - 1);
doupdate();
-#if HAVE_GETTIMEOFDAY
-#define TIMEVAL2S(data) ((double) data.tv_sec + ((double) data.tv_usec / 1.0e6))
if (timing) {
- double elapsed;
- gettimeofday(&after, 0);
- elapsed = (TIMEVAL2S(after) - TIMEVAL2S(before));
+ GetClockTime(&after);
move(LINES - 1, COLS - 12);
- printw("Secs: %2.03f", elapsed);
+ printw("Secs: %6.03f", ElapsedSeconds(&before, &after));
refresh();
}
-#endif
}
} while