[Pkg-wmaker-commits] [wmbubble] 91/207: Prefer integer math as much as possible for calculating clock angles
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:18:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbubble.
commit 7f171bd52e04437badf35d8505f89a39ddc8d403
Author: Robert Jacobs <rnjacobs at mit.edu>
Date: Sun Aug 21 01:36:47 2011 -0700
Prefer integer math as much as possible for calculating clock angles
---
bubblemon.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bubblemon.c b/bubblemon.c
index f3e81c0..9f9eb85 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -1225,14 +1225,14 @@ void draw_clockhands(void) {
gettimeofday(&tv,NULL);
mytime = localtime(&tv.tv_sec);
- theta = ((mytime->tm_hour % 12) / 6.0 + mytime->tm_min / 360.0 + mytime->tm_sec/21600.0)*M_PI;
+ theta = (mytime->tm_hour * 3600u + mytime->tm_min * 60u + mytime->tm_sec) * (M_PI / 21600.0);
draw_aa_line(BOX_SIZE/2,
(BOX_SIZE-10)/2,
BOX_SIZE/2 + 0.6*(BOX_SIZE-10)/2 * sin(theta),
(BOX_SIZE-10)/2 - 0.6*(BOX_SIZE-10)/2 * cos(theta),
hourcolor);
- theta = (mytime->tm_min * 60000000u + mytime->tm_sec * 1000000u + tv.tv_usec) * M_PI / (3600000000u/2);
+ theta = (mytime->tm_min * 60000000u + mytime->tm_sec * 1000000u + tv.tv_usec) * (M_PI / 1800000000u);
/* theta = (mytime->tm_min / 30.0 + mytime->tm_sec / 1800.0)*M_PI; */
draw_aa_line(BOX_SIZE/2,
(BOX_SIZE-10)/2,
@@ -1240,7 +1240,7 @@ void draw_clockhands(void) {
(BOX_SIZE-10)/2 - 0.75*(BOX_SIZE-10)/2 * cos(theta),
mincolor);
- theta = (mytime->tm_sec * 1000000 + tv.tv_usec) * M_PI / (60000000/2);
+ theta = (mytime->tm_sec * 1000000u + tv.tv_usec) * (M_PI / 30000000u);
/* theta = mytime->tm_sec / 30.0 * M_PI; */
draw_aa_line(BOX_SIZE/2,
(BOX_SIZE-10)/2,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbubble.git
More information about the Pkg-wmaker-commits
mailing list