[all-commits] [llvm/llvm-project] 14df65: [libc++][chrono] Fix years/months periods on GCC/i...

Leonidas Spyropoulos via All-commits all-commits at lists.llvm.org
Sun Sep 27 08:19:51 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 14df65f5db67d0096ef2360abb1e30891dae66b5
      https://github.com/llvm/llvm-project/commit/14df65f5db67d0096ef2360abb1e30891dae66b5
  Author: Leonidas Spyropoulos <artafinde at gmail.com>
  Date:   2026-09-27 (Sun, 27 Sep 2026)

  Changed paths:
    M libcxx/include/__chrono/duration.h
    M libcxx/test/std/time/months.pass.cpp
    M libcxx/test/std/time/years.pass.cpp

  Log Message:
  -----------
  [libc++][chrono] Fix years/months periods on GCC/i386 (#223669)

`static_cast<int>(365.2425 * 60 * 60 * 24)`, added in
f537b4e51822b19780386e0575ff95e82f8ec445, isn't exactly 31556952 on
every host: GCC targeting i386 folds it in x87 extended precision and
gets 31556951, making `years::period` and `months::period` coprime and
breaking `year_month` arithmetic.

Use the literal values instead, there's no readability to lose since
they were only there to avoid a template instantiation in the first
place.

Signed-off-by: Leonidas Spyropoulos <artafinde at archlinux.org>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list