https://gcc.gnu.org/g:0a8a126410d1eb3201fbc2be2f35d8b519df0880

commit r14-12979-g0a8a126410d1eb3201fbc2be2f35d8b519df0880
Author: Jonathan Wakely <[email protected]>
Date:   Wed Oct 28 15:26:55 2026 +0000

    libstdc++: Improve exception text from chrono::tzdb::locate_zone
    
    I think "cannot locate time zone" is better than "cannot locate zone".
    If an application shows this message to a user then mentioning "time
    zone" is more user-friendly than expecting people to recognise what
    "std::chrono::tzdb" means. That class name is only meaningful to C++
    developers.
    
    Furthmore, if the application removes the "std::chrono::tzdb: " prefix
    then this leaves a reasonable descriptive message that isn't too
    cryptic.
    
    libstdc++-v3/ChangeLog:
    
            * src/c++20/tzdb.cc (tzdb::locate_zone): Adjust exception text
            to say "time zone".
            * testsuite/std/time/tzdb/links.cc: Adjust expected exception
            text.
    
    Reviewed-by: Tomasz KamiƄski <[email protected]>
    
    (cherry picked from commit 4df0aa192d9308936d6f2f0dc643c8c7ba31e46c)

Diff:
---
 libstdc++-v3/src/c++20/tzdb.cc                | 2 +-
 libstdc++-v3/testsuite/std/time/tzdb/links.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc
index 598d3ddb9918..6a91489117bb 100644
--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -1749,7 +1749,7 @@ namespace std::chrono
   {
     if (auto tz = do_locate_zone(zones, links, tz_name))
       return tz;
-    string_view err = "std::chrono::tzdb: cannot locate zone: ";
+    string_view err = "std::chrono::tzdb: cannot locate time zone: ";
     string str;
     str.reserve(err.size() + tz_name.size());
     str += err;
diff --git a/libstdc++-v3/testsuite/std/time/tzdb/links.cc 
b/libstdc++-v3/testsuite/std/time/tzdb/links.cc
index 0ba214846c6e..8d4cd9349ccb 100644
--- a/libstdc++-v3/testsuite/std/time/tzdb/links.cc
+++ b/libstdc++-v3/testsuite/std/time/tzdb/links.cc
@@ -117,7 +117,7 @@ Link Cycle4_D Cycle4_A
     VERIFY( false );
   } catch (const std::runtime_error& e) {
     std::string_view what(e.what());
-    VERIFY( what.ends_with("cannot locate zone: BadLink") );
+    VERIFY( what.ends_with("cannot locate time zone: BadLink") );
   }
 
   // LinkSelf forms a link cycle with itself.

Reply via email to