From c129bec59a25b62b25763798d4a269a7a2fabe54 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 12 Sep 2017 15:49:30 +0100 Subject: [PATCH] dmktime(): Break assignments so `*=' and `+=' can be used. Add comments tracking the units of `result' from days to seconds. --- sbr/dtime.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sbr/dtime.c b/sbr/dtime.c index dd6802b2..f661ed14 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -345,12 +345,15 @@ dmktime (struct tws *tw) while (--mon) result += dmsize[mon - 1]; result += mday - 1; - result = 24 * result + hour; - result = 60 * result + min; - result = 60 * result + sec; + result *= 24; /* Days to hours. */ + result += hour; + result *= 60; /* Hours to minutes. */ + result += min; + result *= 60; /* Minutes to seconds. */ + result += sec; result -= 60 * tw->tw_zone; if (tw->tw_flags & TW_DST) - result -= 60 * 60; + result -= 60 * 60; /* One hour. */ return (tw->tw_clock = result); } -- 2.56.0