[clang] [clang-tools-extra] [libc] [libc][c11] implement ctime (PR #107285)

Зишан Мирза via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 11:40:14 PDT 2024


================
@@ -156,6 +156,13 @@ LIBC_INLINE struct tm *gmtime_internal(const time_t *timer, struct tm *result) {
   return result;
 }
 
+// TODO: localtime is not yet implemented and a temporary solution is to
+//       use gmtime, https://github.com/llvm/llvm-project/issues/107597
+LIBC_INLINE struct tm *localtime(const time_t *timer) {
+  struct tm *result = {0};
----------------
zimirza wrote:

Sure, I have now made `result` `static`. I just noticed that `tm` gets intialized in `update_from_seconds`, so there is no need to initialize `result` in this function.

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


More information about the cfe-commits mailing list