X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Ftclock.c;h=23ceb6bf102fd809c9308dc53d833b2de80b7aca;hp=75b6570f4a032b80211c1bc16f864036a3afd7b2;hb=HEAD;hpb=a09e8b13568e210a03ca4ad64e8552c0edea07c5 diff --git a/test/tclock.c b/test/tclock.c index 75b6570f..1a749628 100644 --- a/test/tclock.c +++ b/test/tclock.c @@ -1,4 +1,4 @@ -/* $Id: tclock.c,v 1.47 2022/12/10 23:23:27 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);