>From df82c16699ac1d6ff8d64d316f0175fa6a14ade3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 28 Jul 2015 11:12:43 -0700
Subject: [PROPOSED PATCH 4/4] Simplify timesub based on integer time_t

* localtime.c (timesub): Further simplify, given that we
now assume time_t is an integer.
---
 localtime.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/localtime.c b/localtime.c
index 3987491..94006df 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1581,7 +1581,7 @@ timesub(const time_t *timep, int_fast32_t offset,
 	}
 	y = EPOCH_YEAR;
 	tdays = *timep / SECSPERDAY;
-	rem = *timep - tdays * SECSPERDAY;
+	rem = *timep % SECSPERDAY;
 	while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
 		int		newy;
 		register time_t	tdelta;
@@ -1604,13 +1604,6 @@ timesub(const time_t *timep, int_fast32_t offset,
 		tdays -= leapdays;
 		y = newy;
 	}
-	{
-		register int_fast32_t	seconds;
-
-		seconds = tdays * SECSPERDAY;
-		tdays = seconds / SECSPERDAY;
-		rem += seconds - tdays * SECSPERDAY;
-	}
 	/*
 	** Given the range, we can now fearlessly cast...
 	*/
-- 
2.1.4

