[llvm-branch-commits] [libcxx] [libc++][chrono] Improves date formatting. (PR #86127)

Louis Dionne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 16 08:47:46 PDT 2024


================
@@ -322,15 +322,13 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
         __formatter::__format_year(__sstr, __t.tm_year + 1900);
         break;
 
-      case _CharT('F'): {
-        int __year = __t.tm_year + 1900;
-        if (__year < 1000) {
-          __formatter::__format_year(__sstr, __year);
-          __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday);
-        } else
-          __facet.put(
-              {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
-      } break;
+      case _CharT('F'):
+        // Depending on the platform's libc the range of supported years is
+        // limited. Intead of of testing all conditions use the internal
----------------
ldionne wrote:

```suggestion
        // limited. Instead of testing all conditions, use the internal
```

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


More information about the llvm-branch-commits mailing list