[libc-commits] [libc] [libc] implement localtime (PR #110363)

Зишан Мирза via libc-commits libc-commits at lists.llvm.org
Sun Oct 6 10:39:11 PDT 2024


================
@@ -0,0 +1,52 @@
+//===-- Unittests for localtime_s -----------------------------------------===//
+//
+// 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/localtime_s.h"
+#include "src/time/mktime.h"
+#include "src/time/time_utils.h"
+#include "test/UnitTest/Test.h"
+#include "test/src/time/TmHelper.h"
+
+using LIBC_NAMESPACE::time_utils::TimeConstants;
+
+TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp0) {
+  struct tm input;
+  const time_t t_ptr = 0;
+  int result = LIBC_NAMESPACE::localtime_s(&t_ptr, &input);
+  ASSERT_EQ(-1, result);
----------------
zimirza wrote:

Thank you for the feedback. I have fixed this now.

https://github.com/llvm/llvm-project/pull/110363


More information about the libc-commits mailing list