aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-03-16 03:15:57 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-05-23 14:36:25 -0700
commit94c7d826c97ec1ae6ced9f83fe1fe6cfcc235edb (patch)
tree0591c467cffc2403ec236f4b929a29f03c587e36 /time
parentce73d683974b3efc9e477cecb62d178e12cd1421 (diff)
downloadglibc-94c7d826c97ec1ae6ced9f83fe1fe6cfcc235edb.zip
glibc-94c7d826c97ec1ae6ced9f83fe1fe6cfcc235edb.tar.gz
glibc-94c7d826c97ec1ae6ced9f83fe1fe6cfcc235edb.tar.bz2
mktime: simplify computation of average
* time/mktime.c (ranged_convert): Use new time_t_avg function instead of rolling our own (probably-slower) code.
Diffstat (limited to 'time')
-rw-r--r--time/mktime.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/time/mktime.c b/time/mktime.c
index dd7daaf..f4d9cf1 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -319,9 +319,7 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
they differ by 1. */
while (bad != ok + (bad < 0 ? -1 : 1))
{
- time_t mid = *t = (bad < 0
- ? bad + ((ok - bad) >> 1)
- : ok + ((bad - ok) >> 1));
+ time_t mid = *t = time_t_avg (ok, bad);
r = convert (t, tp);
if (r)
ok = mid;