================
@@ -612,6 +643,16 @@ void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& 
__rules) {
   std::ranges::sort(__tzdb.zones);
   std::ranges::sort(__tzdb.links);
   std::ranges::sort(__rules, {}, [](const auto& p) { return p.first; });
+
+  // There are two files with the leap second information
+  // - leapseconds as specified by zic
+  // - leap-seconds.list the source data
+  // The latter is much easier to parse, it seems Howard shares that
+  // opinion.
+  chrono::__parse_leap_seconds(__tzdb.leap_seconds, ifstream{__root / 
"leap-seconds.list"});
+  // Note the input is sorted, but that does not seem to be are
+  // requirement, it is a requirement in the Standard.
+  std::ranges::sort(__tzdb.leap_seconds);
----------------
ldionne wrote:

```suggestion
  // The Standard requires the leap seconds to be sorted.
  // leap-seconds.list usually provides them in sorted order, but that is not
  // guaranteed so we ensure it here.
  std::ranges::sort(__tzdb.leap_seconds);
```

https://github.com/llvm/llvm-project/pull/82113
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to