[libcxx-commits] [libcxx] [libc++][TZDB] Fixes parsing interleaved rules. (PR #84808)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 12 09:09:38 PDT 2024


================
@@ -511,14 +511,33 @@ static string __parse_version(istream& __input) {
   return chrono::__parse_string(__input);
 }
 
+[[nodiscard]]
+static __tz::__rule& __create_entry(__tz::__rules_storage_type& __rules, const string& __name) {
+  auto __result = [&]() -> __tz::__rule& {
+    auto& __rule = __rules.emplace_back(__name, vector<__tz::__rule>{});
+    return __rule.second.emplace_back();
+  };
+
+  if (__rules.empty())
+    return __result();
+
+  // Typically rules are in contiguous order in the database.
+  // But there are exceptions. For example, NZ and Chatham are interleaved.
----------------
ldionne wrote:

```suggestion
  // Typically rules are in contiguous order in the database.
  // But there are exceptions, some rules are interleaved.
```

Otherwise the comment might not age well.

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


More information about the libcxx-commits mailing list