From 275cecdfc39641c692128c50b622c902cd1230f3 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 7 Jun 2020 22:22:18 -0700 Subject: time64: Remove code duplication in separate if branches by combining the conditions [clang-tidy] Found with bugprone-branch-clone Signed-off-by: Rosen Penev --- src/time64.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/time64.c b/src/time64.c index 364e159..b62bc86 100644 --- a/src/time64.c +++ b/src/time64.c @@ -227,12 +227,7 @@ Time64_T timegm64(const struct TM *date) { Year orig_year = (Year)date->tm_year; int cycles = 0; - if( orig_year > 100 ) { - cycles = (orig_year - 100) / 400; - orig_year -= cycles * 400; - days += (Time64_T)cycles * days_in_gregorian_cycle; - } - else if( orig_year < -300 ) { + if( (orig_year > 100) || (orig_year < -300) ) { cycles = (orig_year - 100) / 400; orig_year -= cycles * 400; days += (Time64_T)cycles * days_in_gregorian_cycle; -- cgit v1.1-32-gdbae