The _M_is_leap_second flag doesn't actually mean the time is a leap
second, additional checks are needed to confirm that. It really just
means that we parsed "60" or something like "60.123" for the seconds
field. How the caller interprets that depends on the caller.

Rename it to _M_60th_second which is more accurate and avoids implying
that the parsed time is definitely a leap second.

libstdc++-v3/ChangeLog:

        * include/bits/chrono_io.h (_Parser::_M_is_leap_second): Rename
        to _M_60th_second.
---

As suggested by Tomasz.

Tested x86_64-linux. Pushed to trunk.

 libstdc++-v3/include/bits/chrono_io.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/include/bits/chrono_io.h 
b/libstdc++-v3/include/bits/chrono_io.h
index 33f6fcb9d2c6..028e60075448 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -3450,7 +3450,7 @@ namespace __detail
       year_month_day _M_ymd{};
       weekday _M_wd{};
       __format::_ChronoParts _M_need;
-      unsigned _M_is_leap_second : 1 {};
+      unsigned _M_60th_second : 1 {};
       unsigned _M_reserved : 15 {};
 
       template<typename _CharT, typename _Traits, typename _Alloc>
@@ -3923,7 +3923,7 @@ namespace __detail
       __detail::_Parser_t<_Duration> __p(__need);
       if (__p(__is, __fmt, __abbrev, __offset))
        {
-         if (__p._M_is_leap_second)
+         if (__p._M_60th_second)
            __is.setstate(ios_base::failbit);
          else
            {
@@ -3962,7 +3962,7 @@ namespace __detail
          auto __ut = utc_clock::from_sys(__p._M_sys_days) + __p._M_time
                        - *__offset;
          // Reject ":60" seconds unless the utc_time is a known leap second.
-         if (__p._M_is_leap_second
+         if (__p._M_60th_second
                && (chrono::floor<seconds>(__p._M_time - *__offset) != hours(24)
                      || !chrono::get_leap_second_info(__ut).is_leap_second))
            __is.setstate(ios_base::failbit);
@@ -3995,7 +3995,7 @@ namespace __detail
       __detail::_Parser_t<_Duration> __p(__need);
       if (__p(__is, __fmt, __abbrev, __offset))
        {
-         if (__p._M_is_leap_second)
+         if (__p._M_60th_second)
            __is.setstate(ios_base::failbit);
          else
            {
@@ -4030,7 +4030,7 @@ namespace __detail
       __detail::_Parser_t<_Duration> __p(__need);
       if (__p(__is, __fmt, __abbrev, __offset))
        {
-         if (__p._M_is_leap_second)
+         if (__p._M_60th_second)
            __is.setstate(ios_base::failbit);
          else
            {
@@ -5461,7 +5461,7 @@ namespace __detail
                      __t += __s;
                      // Record that we had "60" or "60.ddd" for seconds.
                      // Caller checks for valid leap second, if needed.
-                     _M_is_leap_second = __s >= seconds(60);
+                     _M_60th_second = __s >= seconds(60);
                    }
 
                  if (__ok)
-- 
2.55.0

Reply via email to