[libc-commits] [libc] [libc] Implement strftime (PR #111305)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Nov 12 11:29:09 PST 2024


================
@@ -0,0 +1,39 @@
+//===-- Core Structures for printf ------------------------------*- 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_STDIO_STRFTIME_CORE_CORE_STRUCTS_H
+#define LLVM_LIBC_SRC_STDIO_STRFTIME_CORE_CORE_STRUCTS_H
+
+#include "src/__support/CPP/string_view.h"
+#include <time.h>
+
+namespace LIBC_NAMESPACE_DECL {
+namespace strftime_core {
+
+struct FormatSection {
+  bool has_conv{false};
+  bool isE{false};
+  bool isO{false};
----------------
michaelrj-google wrote:

These should be stored with an enum like `LengthModifier`. Additionally, the standard mentions two flag characters that need to be stored, similar to printf (`0` and `+`), see: https://pubs.opengroup.org/onlinepubs/9799919799/functions/strftime.html

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


More information about the libc-commits mailing list