https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123165

            Bug ID: 123165
           Summary: Optimize chrono::__detail::__get_leap_second_info
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

If we look up the leap second info for a time ss that is after the expiry time
of the static leapseconds list in the header, then we always use
get_tzdb().leap_seconds because the runtime might have loaded a more recent
list from /usr/share/zoneinfo/leapseconds

If we find that there were no additional leap seconds between the ones known in
the static list and the value ss, then we could update the expiry time in the
header, so that we don't bother calling into the library next time.

i.e. if we know that there are no additional leap seconds inserted between the
previous expiry time and ss, then we can set the expiry time to ss.

We could use a static atomic integer to store the expiry time, so it can be
updated safely.

Reply via email to