diff options
Diffstat (limited to 'agent/gpg-agent.c')
-rw-r--r-- | agent/gpg-agent.c | 16 |
1 files changed, 13 insertions, 3 deletions
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. */ |