fix strptime

This commit is contained in:
wxhwang 2023-09-14 11:10:27 +00:00 committed by ob-robot
parent cf52d51b00
commit fdd61a18d7
3 changed files with 3 additions and 0 deletions

View File

@ -55,6 +55,7 @@ static int64_t strtotime(const char *date_time)
{
int64_t time = 0;
struct tm tm_time;
memset(&tm_time, 0, sizeof(struct tm));
if (NULL == strptime(date_time, "%a, %d %b %Y %H:%M:%S %Z", &tm_time)) {
//skip set ret, for compat data formate
cos_warn_log("[COS]failed to transform time, time=%s\n", date_time);

View File

@ -1627,6 +1627,7 @@ int ObStorageOssUtil::strtotime(const char *date_time, int64_t &time)
int ret = OB_SUCCESS;
time = 0;
struct tm tm_time;
memset(&tm_time, 0, sizeof(struct tm));
if (OB_ISNULL(date_time)) {
ret = OB_INVALID_ARGUMENT;
OB_LOG(WARN, "strtotime get invalid argument", K(ret), KP(date_time));

View File

@ -714,6 +714,7 @@ bool ObConfigMomentItem::set(const char *str)
{
int ret = true;
struct tm tm_value;
memset(&tm_value, 0, sizeof(struct tm));
if (0 == STRCASECMP(str, "disable")) {
value_.disable_ = true;
} else if (OB_ISNULL(strptime(str, "%H:%M", &tm_value))) {