summaryrefslogtreecommitdiff
path: root/libc/src/time/gmtime_r.cpp
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-03-21 17:42:03 -0700
committerRaman Tenneti <rtenneti@google.com>2021-03-22 14:04:05 -0700
commit8b35159ac720fcb9914e4931b416e17b0fbda771 (patch)
tree11efd102cd3e11ec8ecd929b5b16ef9ec6d9f053 /libc/src/time/gmtime_r.cpp
parentca28e32359c60da6216960522c545c0c20761a21 (diff)
[libc] Introduces gmtime_r to LLVM libc, based on C99/C2X/Single Unix Sp.
gmtime and gmtime_r share the same common code. They call gmtime_internal a static inline function. Thus added only validation tests for gmtime_r. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D99046
Diffstat (limited to 'libc/src/time/gmtime_r.cpp')
-rw-r--r--libc/src/time/gmtime_r.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/libc/src/time/gmtime_r.cpp b/libc/src/time/gmtime_r.cpp
new file mode 100644
index 000000000000..67bf12696e2e
--- /dev/null
+++ b/libc/src/time/gmtime_r.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of gmtime_r function -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/time/gmtime_r.h"
+#include "src/__support/common.h"
+#include "src/time/time_utils.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(struct tm *, gmtime_r,
+ (const time_t *timer, struct tm *result)) {
+ return time_utils::gmtime_internal(timer, result);
+}
+
+} // namespace __llvm_libc