diff options
author | Rosen Penev | 2020-06-07 22:22:18 -0700 |
---|---|---|
committer | Nikias Bassen | 2020-11-24 01:25:10 +0100 |
commit | 275cecdfc39641c692128c50b622c902cd1230f3 (patch) | |
tree | c910fc870f14528d23e351cfe77f9ab2b865c6b4 /src | |
parent | e61a5331cb219a38a1b67620045c9f894669291f (diff) | |
download | libplist-275cecdfc39641c692128c50b622c902cd1230f3.tar.gz libplist-275cecdfc39641c692128c50b622c902cd1230f3.tar.bz2 |
time64: Remove code duplication in separate if branches by combining the conditions
[clang-tidy] Found with bugprone-branch-clone
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/time64.c | 7 |
1 files changed, 1 insertions, 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; |