From d85d12ad3a51bf2986936f8037c1c269b052c9f7 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 8 Feb 2022 14:29:41 +0800 Subject: [PATCH] [TD-11220](query): time related functions --- src/os/inc/osTime.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/os/inc/osTime.h b/src/os/inc/osTime.h index 52e6c376a6..1fb21ff38b 100644 --- a/src/os/inc/osTime.h +++ b/src/os/inc/osTime.h @@ -77,6 +77,15 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) { } } +//@return timestamp of today at 00:00:00 in seconds +static FORCE_INLINE int64_t taosGetTimestampToday() { + time_t t = time(NULL); + struct tm * tm= localtime(&t); + tm->tm_hour = 0; + tm->tm_min = 0; + tm->tm_sec = 0; + return (int64_t)mktime(tm); +} typedef struct SInterval { int32_t tz; // query client timezone -- GitLab