Commit 275cecdf authored by Rosen Penev's avatar Rosen Penev Committed by Nikias Bassen

time64: Remove code duplication in separate if branches by combining the conditions

[clang-tidy] Found with bugprone-branch-clone
Signed-off-by: 's avatarRosen Penev <rosenp@gmail.com>
parent e61a5331
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment