From 2873422f4f2f5af84b2057e0f3c0ee879756809e Mon Sep 17 00:00:00 2001 From: Hui Li Date: Sun, 28 Jun 2020 19:13:40 +0800 Subject: [PATCH] [coverity scan] --- src/util/src/ttime.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/src/ttime.c b/src/util/src/ttime.c index 176f9be7fb..96e0eaa214 100644 --- a/src/util/src/ttime.c +++ b/src/util/src/ttime.c @@ -56,11 +56,13 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0, year -= 1; } - int64_t res = 367*((int64_t)mon)/12; - - res += ((int64_t)(year/4 - year/100 + year/400 + day + year*365) - 719499); // this value may be less than 0 + //int64_t res = (((((int64_t) (year/4 - year/100 + year/400 + 367*mon/12 + day) + + // year*365 - 719499)*24 + hour)*60 + min)*60 + sec); + int64_t res; + res = 367*((int64_t)mon)/12; + res += year/4 - year/100 + year/400 + day + year*365 - 719499; res = res*24; - res = ((res + hour) * 60 + min) * 60 + sec; + res = ((res + hour) * 60 + min) * 60 + sec; return (res + timezone); } -- GitLab