[libc-commits] [libc] [libc] Add `ctime_s` (PR #110676)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Oct 8 08:22:23 PDT 2024


================
@@ -0,0 +1,21 @@
+//===-- Implementation header of ctime_s ------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_TIME_CTIME_S_H
+#define LLVM_LIBC_SRC_TIME_CTIME_S_H
+
+#include "hdr/types/time_t.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int ctime_s(char *buffer, size_t buffer_size, const time_t *t_ptr);
----------------
nickdesaulniers wrote:

```
/android0/llvm-project/libc/src/time/ctime_s.h:17:27: error: unknown type name 'size_t'; did you mean 'time_t'?
   17 | int ctime_s(char *buffer, size_t buffer_size, const time_t *t_ptr);
      |                           ^~~~~~
      |                           time_t
```
Make sure to `#include <stddef.h>`.

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


More information about the libc-commits mailing list