mktime: simplify computation of average
* time/mktime.c (ranged_convert): Use new time_t_avg function instead of rolling our own (probably-slower) code.
This commit is contained in:
parent
ce73d68397
commit
94c7d826c9
@ -1,5 +1,9 @@
|
||||
2012-05-23 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
mktime: simplify computation of average
|
||||
* time/mktime.c (ranged_convert): Use new time_t_avg function
|
||||
instead of rolling our own (probably-slower) code.
|
||||
|
||||
mktime: do not assume signed right shift propagates sign bit
|
||||
* time/mktime.c (isdst_differ): New static function.
|
||||
(__mktime_internal): No need to normalize tm_isdst now.
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user