From e814ec4ca3ad254c8c24ef94617e1d12587b0f47 Mon Sep 17 00:00:00 2001 From: localvar Date: Wed, 14 Aug 2019 19:33:06 +0800 Subject: [PATCH] fix #349 --- src/util/src/ttime.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/util/src/ttime.c b/src/util/src/ttime.c index 0e749b5be9..05ba01979e 100644 --- a/src/util/src/ttime.c +++ b/src/util/src/ttime.c @@ -142,21 +142,15 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) { i += 2; } - if (hour > 12) { + int64_t minute = strnatoi(&str[i], 2); + if (minute > 59) { return -1; } - int64_t sec = strnatoi(&str[i], 2); - if (sec > 70) { - return -1; - } - - sec += (hour * 3600); - if (str[0] == '+') { - *tzOffset = -sec; + *tzOffset = -(hour * 3600 + minute * 60); } else { - *tzOffset = sec; + *tzOffset = hour * 3600 + minute * 60; } return 0; -- GitLab