fix strptime
This commit is contained in:
parent
cf52d51b00
commit
fdd61a18d7
@ -55,6 +55,7 @@ static int64_t strtotime(const char *date_time)
|
|||||||
{
|
{
|
||||||
int64_t time = 0;
|
int64_t time = 0;
|
||||||
struct tm tm_time;
|
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)) {
|
if (NULL == strptime(date_time, "%a, %d %b %Y %H:%M:%S %Z", &tm_time)) {
|
||||||
//skip set ret, for compat data formate
|
//skip set ret, for compat data formate
|
||||||
cos_warn_log("[COS]failed to transform time, time=%s\n", date_time);
|
cos_warn_log("[COS]failed to transform time, time=%s\n", date_time);
|
||||||
|
@ -1627,6 +1627,7 @@ int ObStorageOssUtil::strtotime(const char *date_time, int64_t &time)
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
time = 0;
|
time = 0;
|
||||||
struct tm tm_time;
|
struct tm tm_time;
|
||||||
|
memset(&tm_time, 0, sizeof(struct tm));
|
||||||
if (OB_ISNULL(date_time)) {
|
if (OB_ISNULL(date_time)) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
OB_LOG(WARN, "strtotime get invalid argument", K(ret), KP(date_time));
|
OB_LOG(WARN, "strtotime get invalid argument", K(ret), KP(date_time));
|
||||||
|
@ -714,6 +714,7 @@ bool ObConfigMomentItem::set(const char *str)
|
|||||||
{
|
{
|
||||||
int ret = true;
|
int ret = true;
|
||||||
struct tm tm_value;
|
struct tm tm_value;
|
||||||
|
memset(&tm_value, 0, sizeof(struct tm));
|
||||||
if (0 == STRCASECMP(str, "disable")) {
|
if (0 == STRCASECMP(str, "disable")) {
|
||||||
value_.disable_ = true;
|
value_.disable_ = true;
|
||||||
} else if (OB_ISNULL(strptime(str, "%H:%M", &tm_value))) {
|
} else if (OB_ISNULL(strptime(str, "%H:%M", &tm_value))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user