about summary refs log tree commit diff
path: root/time/mktime.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/mktime.c')
-rw-r--r--time/mktime.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/time/mktime.c b/time/mktime.c
index ffbb5ea171..6d5b8cf838 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -323,7 +323,7 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
       while (true)
 	{
 	  long_int mid = long_int_avg (ok, bad);
-	  if (mid != ok && mid != bad)
+	  if (mid == ok || mid == bad)
 	    break;
 	  r = convert_time (convert, mid, tp);
 	  if (r)
@@ -332,6 +332,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
 	    bad = mid;
 	}
 
+      *t = ok;
+
       if (!r && ok)
 	{
 	  /* The last conversion attempt failed;