aboutsummaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-12-08 19:10:42 +0000
committerWerner Koch <[email protected]>2008-12-08 19:10:42 +0000
commit78ff45c49e7c78149b26df8c10250338a37cc1a9 (patch)
tree3b72156d71e230ce2dbee1694556c6a5d024f5e8 /agent
parentFix bug 901. (diff)
downloadgnupg-78ff45c49e7c78149b26df8c10250338a37cc1a9.tar.gz
gnupg-78ff45c49e7c78149b26df8c10250338a37cc1a9.zip
Align ticker to the full or half second.
Diffstat (limited to 'agent')
-rw-r--r--agent/ChangeLog5
-rw-r--r--agent/gpg-agent.c16
2 files changed, 18 insertions, 3 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index db96f11d3..65669d76a 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-08 Werner Koch <[email protected]>
+
+ * gpg-agent.c (handle_connections): Sync the ticker to the next
+ full second. This is bug#871.
+
2008-12-05 Werner Koch <[email protected]>
* minip12.c (decrypt_block): Fix const modified of CHARSETS.
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 454d71590..8aae8a6a3 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1794,10 +1794,20 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
FD_ZERO (&fdset);
}
- /* Create a timeout event if needed. */
+ /* Create a timeout event if needed. To help with power saving
+ we syncronize the ticks to the next full second. */
if (!time_ev)
- time_ev = pth_event (PTH_EVENT_TIME,
- pth_timeout (TIMERTICK_INTERVAL, 0));
+ {
+ pth_time_t nexttick;
+
+ nexttick = pth_timeout (TIMERTICK_INTERVAL, 0);
+ if (nexttick.tv_usec > 10) /* Use a 10 usec threshhold. */
+ {
+ nexttick.tv_sec++;
+ nexttick.tv_usec = 0;
+ }
+ time_ev = pth_event (PTH_EVENT_TIME, nexttick);
+ }
/* POSIX says that fd_set should be implemented as a structure,
thus a simple assignment is fine to copy the entire set. */