X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=test%2Ftclock.c;h=1a749628914dd82492aa7bf95816379cc58233f6;hb=2035f48ed0fc56ec4e5caf9b7c10e00ba43e160f;hp=0773b3b76e384e0c7c4b0b702ec904bb3e74e416;hpb=6641601a9dd7f34deeaa978899b3730b27635afb;p=ncurses.git diff --git a/test/tclock.c b/test/tclock.c index 0773b3b7..1a749628 100644 --- a/test/tclock.c +++ b/test/tclock.c @@ -1,4 +1,4 @@ -/* $Id: tclock.c,v 1.46 2022/12/04 00:40:11 tom Exp $ */ +/* $Id: tclock.c,v 1.48 2023/02/25 16:42:22 tom Exp $ */ #define NEED_TIME_H #include @@ -133,6 +133,8 @@ VERSION_COMMON() int main(int argc, char *argv[]) { + static TimeType initial; + int i, cx, cy; double cr, mradius, hradius, mangle, hangle; double sangle, sradius, hours; @@ -147,10 +149,7 @@ main(int argc, char *argv[]) char szChar[20]; char *text; short my_bg = COLOR_BLACK; -#if HAVE_GETTIMEOFDAY - struct timeval current; -#endif - double fraction = 0.0; + TimeType current; #if HAVE_USE_DEFAULT_COLORS bool d_option = FALSE; #endif @@ -236,11 +235,9 @@ main(int argc, char *argv[]) hdx = A2X(hangle, hradius); hdy = A2Y(hangle, hradius); -#if HAVE_GETTIMEOFDAY - gettimeofday(¤t, 0); - fraction = ((double) current.tv_usec / 1.0e6); -#endif - sangle = ((t->tm_sec + fraction) * (2.0 * PI) / 60.0); + GetClockTime(¤t); + + sangle = (ElapsedSeconds(&initial, ¤t) * (2.0 * PI) / 60.0); sdx = A2X(sangle, sradius); sdy = A2Y(sangle, sradius); @@ -294,7 +291,7 @@ main(int argc, char *argv[]) } #else int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(void) { printf("This program requires the header math.h and trignometric functions\n"); ExitProgram(EXIT_FAILURE);