From f0481c4882feec48e2a493e459a74fc64df87490 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 15 Mar 2022 19:13:07 +0800 Subject: [PATCH] [TD-13970]: timestamp format shortcut --- src/os/src/detail/osTime.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index fb8c2a5ae6..e25178f2d5 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -336,7 +336,10 @@ int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec, char deli } if (str == NULL) { - return -1; + //if parse failed, try "%Y-%m-%d" format + if (!strptime(timestr, "%Y-%m-%d", &tm)) { + return -1; + } } #ifdef _MSC_VER @@ -378,7 +381,10 @@ int32_t parseLocaltimeWithDst(char* timestr, int64_t* time, int32_t timePrec, ch } if (str == NULL) { - return -1; + //if parse failed, try "%Y-%m-%d" format + if (!strptime(timestr, "%Y-%m-%d", &tm)) { + return -1; + } } /* mktime will be affected by TZ, set by using taos_options */ -- GitLab